UIViewControllerHierarchyInconsistency在ios​​5中工作但在ios6中不工作 [英] UIViewControllerHierarchyInconsistency worked in ios5 but not in ios6

查看:116
本文介绍了UIViewControllerHierarchyInconsistency在ios​​5中工作但在ios6中不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个完美的工作项目,直到我更新到ios6。

I had a perfectly working project until i have updated to ios6.

当我选中一个条形项目以显示一个带有视图的弹出窗口应用程序崩溃...

when i tab on a bar item to show a popover with a view the app crashes...

这是我得到的错误

    "reason: 'A view can only be associated with at most one view controller at a time! View <UIView: 0xaa7d730; frame = (20 0; 748 1024); autoresize = RM+BM; layer = <CALayer: 0xaa7d790>> is associated with <TYOFormViewController: 0xaa7d8b0>. Clear this association before associating this view with <TYOFormViewController: 0x14c68a70>.'"

这里是声明UIViewController的方法和UIPopoverController。

and here is the method that declares the UIViewController and the UIPopoverController.

    - (IBAction)TestDriveTapped:(id)sender{
if (PopoverController != nil) {
    [PopoverController dismissPopoverAnimated:YES];
    self.PopoverController = nil;
}
if (self.PopoverController == nil) {
    UIViewController *bookTestDrive =[[TYOFormViewController alloc] initWithNibName:@"TYOBookTestDriveForm" bundle:nil];

   UIPopoverController *poc  = [[UIPopoverController alloc]
                           initWithContentViewController:bookTestDrive];

   [poc presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
     self.PopoverController = poc;
} else {
    if (PopoverController != nil) {
        [PopoverController dismissPopoverAnimated:YES];
        self.PopoverController = nil;
    }
}

}

错误说我必须清除与TYOFormViewController的关联以将它与TYOFormViewController关联....这是怎么发生的?

The error says i have to clear the association with TYOFormViewController to associate it with TYOFormViewController.... How did this happen???

会爱你的帮助解决这个问题... jstuck整天用它..

Would love your help with this issue... jstuck all day with it..

谢谢

推荐答案

加载一堆xib文件时,我也发生了这种情况。解决方案是进入界面构建器并删除具有与文件所有者相同的类名的任何视图控制器对象。所以在我的情况下,这些文件现在只包含视图和子视图,连接到文件的所有者 - 没有控制器。

I also had this happening when loading a bunch of xib files. The solution was to go into interface builder and delete any view controller objects with the same class name as file's owner. So in my case those files now contain only the view and the subviews, connected to file's owner - no controllers.

在解释时,iOS 6中的内容必定会发生变化xib文件。

Something must have changed under the hood in iOS 6 when interpreting xib files.

这篇关于UIViewControllerHierarchyInconsistency在ios​​5中工作但在ios6中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆