更改模式 UIImagePickerController 父视图

发布于 2024-11-09 12:17:01 字数 549 浏览 0 评论 0原文

我正在尝试构建一个在第一个视图上有一个按钮的应用程序,当您点击该按钮时,它会显示 UIImagePickerController 模式视图。我理想的情况是,一旦您拍照,当模态视图被关闭时,呈现图像选择器的原始视图就会发生变化。

例如,该过程将是 VIEW 1 --(点击按钮) -->模态图像选择器 --(关闭模态视图)--> VIEW 2.

到目前为止,我已经让应用程序加载 UIImagePickerController ,一旦完成,在 didFinishPickingMediaWithInfo 委托方法中,它会设置一个 BOOL 值为 YES ,然后在我的原始视图 (VIEW 1) 的 ViewDidAppear 中,它会在下一个视图中呈现一个新的模式。

这样做的问题是关闭模态视图和下一个视图(VIEW 2)出现之间存在延迟。

有谁知道以上是否可行?如果没有,我可能不得不在图像选择器关闭和第二个视图出现之间显示一个旋转器并说“处理图像”。

I'm trying to build an app that features a button on the first view, when you tap the button it presents the UIImagePickerController modal view. What I would ideally like is once you have taken you photo, when the modal view is dismissed, the original view which presented the image picker changes.

For example, the process would be VIEW 1 -- (tap button) --> MODAL IMAGE PICKER -- (close modal view) --> VIEW 2.

So far I've got the app loading the UIImagePickerController and once you are complete, within the didFinishPickingMediaWithInfo delegate method, it sets a BOOL value to YES and then within the ViewDidAppear of my original view (VIEW 1) it then presents a new modal with the next view.

The problem with this is that there is a delay between the closing the modal view and the next view (VIEW 2) appearing.

Does anyone know if the above is possible? If not, I might have to resort to displaying a spinner and saying "Processing image" between the image picker closing and the second view appearing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不羁少年 2024-11-16 12:17:01

您可以使用导航控制器来解决这个问题。

创建一个导航控制器并将您的第一个控制器推入其中。稍后,从您的第一个控制器中,以模态方式呈现选择器。到目前为止几乎相同,只是我们添加了一个导航控制器。这就是我为了得到你想要的结果所做的。

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    NewController *controller = [[NewController alloc] initWithNibName:nil bundle:nil];
    [self.navigationController pushViewController:controller animated:YES];
    [self dismissModalViewControllerAnimated:YES];
    [controller release];
}

希望这有帮助。

You can use a navigation controller to solve this problem.

Create a navigation controller and push your first controller into it. Later from your first controller, present the picker modally. Pretty much the same until now except that we have added a navigation controller. This is what I did to get your desired result.

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    NewController *controller = [[NewController alloc] initWithNibName:nil bundle:nil];
    [self.navigationController pushViewController:controller animated:YES];
    [self dismissModalViewControllerAnimated:YES];
    [controller release];
}

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文