刚开始使用Xcode 4.5,我在控制台中遇到了这个错误:
警告:尝试在<ViewController:0x1ec3e000>上显示<finishViewController:0x1e56e0a0>,其视图不在窗口层次结构中!
该视图仍在呈现中,应用程序中的所有内容都正常运行.这是iOS 6中的新功能吗?
这是我用来在视图之间切换的代码:
UIStoryboard *storyboard = self.storyboard;
finishViewController *finished =
[storyboard instantiateViewControllerWithIdentifier:@"finishViewController"];
[self presentViewController:finished animated:NO completion:NULL];
Run Code Online (Sandbox Code Playgroud) 我读到了关于另一个用户遇到类似错误的 SO ,但是这个错误是在不同的情况下.
我最初添加View Controller时收到此消息:
Unbalanced calls to begin/end appearance transitions for
<UITabBarController: 0x197870>
Run Code Online (Sandbox Code Playgroud)
该应用程序的结构如下:
我有一个5个标签的TabBarController链接到5个视图控制器.在初始显示选项卡中,我调出一个新的视图控制器来覆盖作为应用程序的介绍.
我使用此代码调用介绍视图控制器:
IntroVC *vc = [[IntroVC alloc] init];
[self presentModalViewController:vc animated:YES];
[vc release];
Run Code Online (Sandbox Code Playgroud)
此IntroVC视图控制器出现后,显示上述错误.
ps我正在使用xCode 4.2和iOS 5.0 SDK,开发iOS 4.3应用程序.
我试图用父视图控制器设置ViewController,以显示它可以提供回调,我使用 PrepareForSegue
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"newQuarter"])
{
[segue.destinationViewController setParentViewController:self];
}
}
Run Code Online (Sandbox Code Playgroud)
它崩溃了,给我错误信息: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller.
所以我尝试使用另一种方法,并在触摸按钮时设置了新的视图控制器,
- (IBAction) buttonClicked
{
NewViewController *newController = [[NewViewController alloc] init];
[newController setParentViewController:self];
[self presentViewController:newController animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)
但是没有运气,它仍然给我同样的错误信息,有人可以请教吗?谢谢!
将我的项目升级到Swift 2.0并使用Xcode 7(GM)之后,我注意到我的一些视图控制器冻结了导航上的应用程序.
仪器向我显示CPU使用率超过9000%并由UIKit和Foundation使用.
你遇到过这个问题吗?
ios ×4
cocoa-touch ×1
hierarchy ×1
ios4 ×1
ios6 ×1
objective-c ×1
segue ×1
views ×1
xcode ×1
xcode7 ×1