Is there a UIImagePickerController replacement that I can use from a controller that is already in a popover?

限于喜欢 提交于 2019-12-12 03:04:46

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/16151673/is-there-a-uiimagepickercontroller-replacement-that-i-can-use-from-a-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!