iphone - iOS 6 : What changed that made this View Controller Hierarchy break?

标签 iphone objective-c uiviewcontroller uinavigationcontroller ios6

以下是在我的 AppDelegate 中:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

customViewController = [[CustomViewController alloc] initWithNibName:@"CustomViewController" bundle:nil];

self.navigationController = [[UINavigationController alloc] initWithRootViewController:customViewController];

[self.navigationController setNavigationBarHidden:YES];

self.window.rootViewController = self.navigationController;

[self.window makeKeyAndVisible];

在实际的 XIB 中, View 与“文件的所有者”关联,这是我在那里的唯一关联..

XIB 层次结构:

Navigation Controller
    - View Controller - Root View Controller
        -View (Associated with File's Owner)

抱歉,如果我不明白这一点,它在之前启动的应用程序上运行良好,但我明白这并不意味着它是正确的。

编辑:抱歉,这是我收到的错误:

* 由于未捕获的异常“UIViewControllerHierarchyInconsistency”而终止应用程序,原因:“一个 View 一次最多只能与一个 View Controller 相关联!查看 < UIView: 0xa192d00;帧 = (0 20; 320 460);自动调整大小 = W+H;层 = < CALayer: 0xa192d60>> 与 < UIViewController: 0xa195c70> 关联。在将此 View 与 关联之前清除此关联。'

最佳答案

确保您的 View 界面在其层次结构中没有额外的 View Controller 。请参阅下面的屏幕截图

之前:
Before

之后:
After

关于iphone - iOS 6 : What changed that made this View Controller Hierarchy break?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12606847/

相关文章:

ios - UIViewControllerAnimatedTransitioning 不会动画帧大小

iOS:self.view.bounds 没有填满整个窗口

ios - 准备 segue 后 swift 关闭导航 Controller

iphone - 在 iPhone 上,AudioStreamer 通过耳机播放,而不是底部扬声器

iphone - iOS 分页控件(导航)

objective-c - NSThread 和对象保留计数问题

ios - Xcode iOS 生成 .png 文件并使用 NSFileManager 保存

ios - 符合 Objective-C 协议(protocol)的 Swift 类

iphone - 七层信息层次 - UITableView - iPhone

iphone - 为什么我无法通过 MFMailComposeViewController 发送邮件?