相机覆盖不鼓励在分离的视图控制器上显示视图控制器

时间:2014-08-12 16:19:11

标签: ios objective-c

我在cameraVC上收到此错误"Presenting view controllers on detached view controllers is discouraged "。我想是因为我正在添加一个未附加在storyboard中的叠加层,而是添加了自己的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.。有人见过这个??

1 个答案:

答案 0 :(得分:2)

“不鼓励在分离的视图控制器上显示视图控制器” 尝试在添加的UIViewControlleView上显示视图控制器时会出现这种情况:

[self.view addSubview:secondViewController.view];

将secondViewController设置为子项

[self addChildViewController:secondViewController];