gpt4 book ai didi

ios - 在导航 Controller 中堆叠 UIImagePickerController?

转载 作者:行者123 更新时间:2023-11-29 12:43:44 25 4
gpt4 key购买 nike

我的应用基本上有两个 View Controller ,从导航 Controller 开始:

1) MainViewController,要求用户选择相机或相册,然后呈现 UIImagePicker

2) PhotoViewController,接收照片。

但是,在第二个 VC 中,当用户点击“返回”时,我宁愿立即返回到他们选择的相机或相册,而不是 MainVC 然后重新加载选择器。

我是否应该分离一个专用于 ImagePicker 的全新 ViewController,而不是将其呈现在 MainViewController 中?使用 pushViewController: 不起作用,因为 “不支持推送导航 Controller ” 可能意味着 imagePickers 也是导航 Controller 。

MainViewController 当前显示如下:

[self.navigationController presentViewController:self.imagePicker animated:YES completion:nil];

感谢任何建议,谢谢。

最佳答案

一个简单的解决方案可能是在您的 MainVC 中有 2 个 bool 值 calledCamera,calledLibrary当您创建新的 VC 时,您将选择图片的那个设置为 YES。所以当你回来的时候...

- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];

if (calledCamera){

//call cameraPicker to load before de MainVc shows
}

if (calledLibrary){

//call the LibraryPicker before...
}
}

关于ios - 在导航 Controller 中堆叠 UIImagePickerController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24196339/

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