gpt4 book ai didi

ios - NavigationController initWithRootViewController 崩溃应用程序 iOS8

转载 作者:行者123 更新时间:2023-11-29 01:49:22 25 4
gpt4 key购买 nike

我正在尝试使用以下代码在 UINavigationController 中呈现一个 UIImagePickerController:

UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
imagePicker.showsCameraControls = NO;
imagePicker.modalPresentationStyle = UIModalPresentationOverCurrentContext;
self.tabBarController.tabBar.hidden = YES;

NSLog(@"HERES THE self.peresntingviewcontorller:: %@", self.presentingViewController);

//[self presentViewController:imagePicker animated:YES completion:^{}];
UINavigationController *cameraNavigationController = [[UINavigationController alloc] initWithRootViewController:imagePicker]; //ERROR HERE
[self presentViewController:cameraNavigationController animated:YES completion:nil];

但是我在添加注释“//ERROR HERE”时遇到错误,这是我尝试启动导航 Controller 的行,其中包含名为 UIImagePickerController 的 Root View 图片选择器。我不知道我做错了什么?有帮助吗?

错误是:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing a navigation controller is not supported'

最佳答案

UIImagePickerController 派生自 UINavigationController,这就是为什么你不能将它推送到另一个 UINavigationController(或设置为 Root View Controller )。

关于ios - NavigationController initWithRootViewController 崩溃应用程序 iOS8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31572131/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com