相关疑难解决方法(0)

尝试呈现模态视图控制器时的UIViewControllerHierarchyInconsistency

尝试使用以下代码显示模态视图控制器

MapViewController *mapView = [[MapViewController alloc] initWithNibName:@"MapViewController" bundle:nil];
    mapView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self.navigationController presentModalViewController:mapView animated:YES];
    [mapView release];
Run Code Online (Sandbox Code Playgroud)

继续收到以下错误..

'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <UIView: 0x1ed815a0; frame = (0 20; 320 460); autoresize = W+H; layer = <CALayer: 0x1ed81600>> is associated with <UIViewController: 0x1ed835a0>. Clear this association before associating this view with <MapViewController: 0x1dd947c0>.'
Run Code Online (Sandbox Code Playgroud)

这是一个我几个月没碰过的旧项目,想知道什么可能导致这样的错误?

xcode objective-c xib uiviewcontroller ios

36
推荐指数
2
解决办法
2万
查看次数

按钮上的iOS6 UIViewControllerHierarchyInconsistency单击

我在iOS 6 iPad中面临问题

  1. 单击按钮 - >使用UITable打开popover
  2. 在选择一行 - > modalviewcontroller打开.
  3. 解雇modalviewcontroller(它工作正常)
  4. 然后再次单击按钮,按钮单击时应用程序崩溃(第1步)

此问题仅适用于iOS 6.它在iOS 5,iOS 4.3中运行良好

*** 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: 0xb847400; frame = (0 0; 185 104); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0xa469e50>; layer = <CALayer: 0xa469f00>; contentOffset: {0, 0}> is associated with <UIViewController: 0xa462f60>. Clear this association before associating this view with <UIViewController: …
Run Code Online (Sandbox Code Playgroud)

objective-c ipad ios-simulator ios6

0
推荐指数
1
解决办法
2381
查看次数

标签 统计

objective-c ×2

ios ×1

ios-simulator ×1

ios6 ×1

ipad ×1

uiviewcontroller ×1

xcode ×1

xib ×1