【问题标题】:iOS 6: What changed that made this View Controller Hierarchy break?iOS 6:是什么改变让这个 View Controller Hierarchy 崩溃了?
【发布时间】:2012-09-18 09:08:48
【问题描述】:

以下在我的 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 中,视图与“文件所有者”相关联,这是我在那里唯一的关联..

XIB 层次结构:

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

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

编辑:对不起,这是我得到的错误:

* 由于未捕获的异常“UIViewControllerHierarchyInconsistency”而终止应用程序,原因:“一个视图一次最多只能与一个视图控制器关联!视图 > 与 相关联。在将此视图与 关联之前清除此关联。'

【问题讨论】:

  • 已添加,对此感到抱歉。
  • 在 xib 中是 CustomViewController 的视图与其他导航控制器相关联吗?
  • 它与“文件的所有者”相关联
  • 我面临同样的问题....模态视图关闭后

标签: iphone objective-c uiviewcontroller uinavigationcontroller ios6


【解决方案1】:

确保您的视图界面在其层次结构中没有额外的视图控制器。请看下面的截图

之前:

之后:

【讨论】:

  • 这解决了困扰我 3 周的问题。谢谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多