我有一个奇怪的问题,特别是在iOS8中。我有一个视图控制器,它显示来自其他视图控制器的内容。这就是我目前正在做的事情:
ViewController *childViewController = [[ViewController alloc] initWithNibName:@"PatientDetailsView" bundle:nil];
[childViewController setPatient:patient];
[self.view addSubview:patientDetailsViewController.view];上面这行代码在iOS8之前的设备上运行良好,但是在iOS8应用程序上被addSubView方法卡住了,编译器没有抛出异常。
我没有在我的项目中使用故事板,所以不能使用容器视图控制器来添加子视图控制器。
发布于 2014-11-29 00:10:27
试试这段代码
ViewController *childViewController = [[ViewController alloc] initWithNibName:@"PatientDetailsView" bundle:nil]; [self addChildViewController:childViewController]; [self.view addSubview:childViewController.view]; [childViewController didMoveToParentViewController:self];
希望这能有所帮助。
https://stackoverflow.com/questions/27190923
复制相似问题