iPhone XCode UITabBarController 和 UINavigationController

标签 iphone ios uinavigationcontroller

当我收到以下错误时,我正在尝试更新我的应用程序以在 iPhone 5 上运行:

Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency',
reason: 'A view can only be associated with at most one view controller at a time!
View <UITableView: 0x88fbe00; frame = (0 20; 320 548); clipsToBounds = YES; opaque = NO; 
autoresize = W+H; gestureRecognizers = <NSArray: 0x8395940>; layer = <CALayer: 0x8395350>;
contentOffset: {0, 0}> is associated with <UIViewController: 0x83967d0>. Clear this
association before associating this view with <UIViewController: 0x8381220>.'

我正在运行 XCode 4.5 版,这在以前从未发生过。我已尝试按照 this question 中的步骤进行操作.这就是我的 MainWindow.xib 的样子:

MainWindow.xib

我做错了什么,我该如何解决?

最佳答案

找到了我的解决方案。在应该加载时打开导致异常的 View 的 XIB 文件。确保 Object 列表顶部没有 ViewController 对象,而 View 位于其下方。如果有,移动 View ,这将移动它下面的所有东西,到与 ViewController 对象相同的级别。现在删除 ViewController 对象并确保您的 XIB 类已正确设置为您的 ViewController 类,希望它能正常工作。

我有同样的问题。 Xcode 4.5 在 iOS6(设备或模拟器)上构建和运行我遇到了这个问题。在 < iOS6 上运行应用程序的 Xcode 4.5 很好。使用 Xcode < 4.5 构建并在 iOS6 上运行的代码完全相同。所以它似乎是 Xcode 4.5 和 iOS6 的组合。我看不出是什么原因造成的。

关于iPhone XCode UITabBarController 和 UINavigationController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12584804/

相关文章:

ios - 如何访问磁力计数据

ios - HTTPS/SSL : Apple rules

iphone - KissXML 不返回字符串

ios - RLMResults 到 ios 中的 NSArray 转换

ios - 如何确定是否正在等待调度信号量?

iphone - 从 UINavigationController 弹出时如何卸载 UITabBarController?

ios - 观察 UINavigationController navigationBar 显示/隐藏

ios - 如何从它的项目 ViewControllers 访问 UITabBarController 的变量

ios - 如何将粘性搜索栏添加到 UITableViewController

html - 发送数据到网站