Sam*_* J. 36 xcode objective-c xib uiviewcontroller ios
尝试使用以下代码显示模态视图控制器
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)
这是一个我几个月没碰过的旧项目,想知道什么可能导致这样的错误?
Luk*_*asz 149
这在我最新的Xcode版本中已经发生过两次.在这两种情况下,我都需要对UIViewController的XIB文件进行更改(在这种情况下,它将是MapViewController.xib:
之前:

后:

我在iOS 6模拟器上运行Apple的示例音频应用程序MixerHost时出现此问题.
相当于上面的修复,即通过将View对象拖到顶层来编辑提供的MixerHostViewController.xib,并丢弃过去用于包含它的现在空ViewController,工作得很好(尽管不是在我花了几个小时工作之前)看看底层问题是什么,所以我现在感觉苹果已经完成了 - 似乎他们收紧了一些东西,但没有费心去检查它是否打破了他们的示例应用程序).
| 归档时间: |
|
| 查看次数: |
20276 次 |
| 最近记录: |