是否有一个UIImagePickerController替换,我可以从已经在弹出框中的控制器使用? [英] Is there a UIImagePickerController replacement that I can use from a controller that is already in a popover?

查看:92
本文介绍了是否有一个UIImagePickerController替换,我可以从已经在弹出框中的控制器使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个使用 UIImagePickerController 的应用程序,让用户从他们的库中选择图像。在iPad上,它显示在弹出窗口中(因为你必须),但显示它的控制器已经在弹出窗口中,并且你不允许显示来自另一个弹出窗口的弹出窗口。我不能修改整个应用程序以避免文件控制器处于弹出框中,所以我想做的是将图像选择器推到文件控制器的导航堆栈上。

I'm writing an app that uses UIImagePickerController to let the user choose images from their library. On the iPad, it shows it in a popover (because you must) but the controller which is showing it is already in a popover, and you're not allowed to show a popover from another popover. I can't rework the whole app to avoid the files controller being in a popover, so what I'd like to do is to push the image picker onto the files controller's navigation stack.

显然这不适用于股票图像选择器,但有许多替代品。有没有人使用其中任何一个可以让我把它们推到导航堆栈上,还是我需要自己编写?

Obviously this isn't going to work with the stock image picker, but there are a lot of alternatives. Has anyone used any of them that would let me push them onto the navigation stack, or do I need to write my own?

推荐答案

正确的解决方案是将图像选择器作为模态视图控制器呈现给现有的视图控制器。将图像选择器的 modalPresentationStyle 设置为 UIModalPresentationCurrentContext

The proper solution is to present the image picker as a modal view controller to your existing view controller. Set the image picker's modalPresentationStyle to UIModalPresentationCurrentContext.

这将在同一个弹出框中显示图像选择器,但作为调用视图控制器上的模态视图控制器。

This will show the image picker in the same popover but as a modal view controller over the calling view controller.

这篇关于是否有一个UIImagePickerController替换,我可以从已经在弹出框中的控制器使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆