Tag:

UINavigationController:呈现视图控制器,同时closures另一个控制器正在iPad上进行

我有一个观点,要求用户login。当用户试图打开该视图,他没有login,我会打电话给他的login视图login,他完成后,我会打电话给他原来的意见,他打算查看。 在iPhone上,这工作正常,因为我推视图控制器。 但在iPad上,我呈现视图控制器这是行不通的。 它说解雇正在进行中,不能显示新的控制者。 这里是代码: – (void) buttonPressed { if (!userLoggedIn) { // userLoggedIn getter calls new screens of login if needed return; // this is executed if user declined to login } MyViewController *temp = [[MyViewController alloc] init]; [self.navigationController presentViewController:temp animated:YES]; // this returns warning that dismissal in progress and does not work } […]

iOS objective-C:在浮点上使用模来从“英尺”获得“英寸”

我正在试图做一个简单的目标C高度转换器。 input是脚的(浮动)variables,我想转换为(int)英尺和(浮动)英寸: float totalHeight = 5.122222; float myFeet = (int) totalHeight; //returns 5 feet float myInches = (totalHeight % 12)*12; //should return 0.1222ft, which becomes 1.46in 但是,我不断从xcode中得到一个错误,我意识到模运算符只能使用(int)和(long)。 有人可以推荐一种替代方法吗? 谢谢!