用于tabbarcontroller的ios6中的UIViewControllerHierarchyInconsistency问题

时间:2013-02-14 07:16:49

标签: ios ios6 uitabbarcontroller

我的应用程序在iOS5中正常运行但是当我切换到iOS6时,由于UIViewControllerHierarchyInconsistency而崩溃了。

错误如下所示:

UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <UILayoutContainerView: 0xa148de0; frame = (0 0; 320 480); autoresize = W+H; layer = <CALayer: 0xa148ea0>> is associated with <UITabBarController: 0xa64af30>. Clear this association before associating this view with <lkViewController: 0xa33faa0>.'

我已经查看了stackoverflow上的一些解决方案,它告诉我删除viewcontrollers。但是当我删除tabbarcontroller时,视图显示不正确。

我的xib文件如下所示:

enter image description here

需要一些指导......谢谢......

编辑:

崩溃来自lkViewController中的这一行:

self.view = m_tabBarController.view;

当m_tabBarController是UITabBarController时。

1 个答案:

答案 0 :(得分:1)

更改

self.view = m_tabBarController.view;

[self.view addSubview:m_tabBarController.view];

将解决问题...

相关问题