我有一个嵌入在 UITabBarController 中的 UIViewController。在我的 PhotoViewController
上,用户可以选择添加照片并调用 UIImagePickerController
。用户选择照片并弹出 View 后,导航栏消失。
显示导航栏。
这是 UIImagePickerController
View ,看起来好像取消按钮在 NavigationBar
下。 (在这张图片中很难看到。)
UIImagePickerController
弹出并重新加载 View 后,NavigationBar
消失了。
下面是我如何调用 UIImagePickerController
。我继承自 UIImagePickerControllerDelegate
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = sourceType;
imagePickerController.delegate = self;
if (sourceType == UIImagePickerControllerSourceTypeCamera) {
imagePickerController.showsCameraControls = YES;
}
self.imagePickerController = imagePickerController;
[self presentViewController:self.imagePickerController animated:YES completion:nil];
尽管代表说它不兼容。
如何纠正问题?
最佳答案
我加了
imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen;
imagePickerController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
这似乎将 imagePickerController 置于当前 View 之上。
关于ios - 弹出 UIImagePickerController 后 UINavigationBar 消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37999095/