转自http://blog.csdn.net/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(红框处)