我在cameraVC上收到此错误"Presenting view controllers on detached view controllers is discouraged "。我认为这是因为我要添加一个未附加在情节提要中的叠加层,而是将其自己的XIB文件加载进来,如下所示:

//set our custom overlay view
    ControlsViewController *overlayViewController = [[ControlsViewController alloc] initWithNibName:@"ControlsViewController" bundle:nil];
    self.imagePicker.cameraOverlayView = overlayViewController.view;

覆盖层可以正常工作,但是当相机开机时出现该错误以及Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.。有人看到过这个吗?

最佳答案

“不建议在分离的视图控制器上呈现视图控制器”
当尝试在添加了以下内容的UIViewControlleView上显示视图控制器时,可能会发生这种情况:

[self.view addSubview:secondViewController.view];

没有将secondViewController设置为子级
[self addChildViewController:secondViewController];

关于ios - 不建议在独立的 View Controller 上显示 View Controller ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25269306/

10-09 23:48