ios error:A view can only be associated with at most one view controller at a time

针对升级Xcode4.5.1后出现的'UIViewControllerHierarchyInconsistency'异常,提供了一种有效的解决方案:调整视图控制器与视图的关系,并确保每个视图仅与一个视图控制器关联。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转自http://blog.youkuaiyun.com/yujie1985/article/details/8166071


xcode 4.3.2上的工程运行,没有问题,更新到xcode4.5.1后,运行,提示异常:

Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View < UIView: 0xa192d00; frame = (0 20; 320 460); autoresize = W+H; layer = < CALayer: 0xa192d60>> is associated with < UIViewController: 0xa195c70>. Clear this association before associating this view with < CustomViewController: 0xa1802a0>.'


google了半天,找到解决方案:

说明一下:1.将之前view controller之下的view,从view controller中移出,直接拖拽就可实现

                  2.然后将view controller删除。在file's owner ,class设置你你自己的class(红框处)


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值