如何使用自定义视图控制器扩展 UIImagePickerController?

发布于 2024-09-09 10:52:19 字数 766 浏览 0 评论 0原文

因为 UIImagePickerController 的默认裁剪框(使用设置 setAllowsEditing:YES 时)对我来说不合适,所以我创建了一个自定义视图控制器,如建议的 此处

当从 UIImagePickerController 选择缩略图时,我从 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 打开此自定义视图控制器 (navigationController) :

[popoverController setContentViewController:navigationController animated:YES];

但似乎 UIImagePickerController 已经关闭,因为自定义视图控制器没有动画呈现。当我取消自定义视图控制器时,我无法返回到 UIImagePickerController 的缩略图视图。有没有办法扩展 UIImagePickerController 以便在取消自定义视图控制器时返回到 UIImagePickerController ?

谢谢!

Because the default cropping frame of an UIImagePickerController (when using the setting setAllowsEditing:YES) isn't the right size for me I've created a custom view controller, like suggested here.

When a thumbnail is selected from the UIImagePickerController I open this custom view controller (navigationController) from - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info:

[popoverController setContentViewController:navigationController animated:YES];

But it seems that the UIImagePickerController is already closed, because the custom view controller is presented without animation. And when I cancel the custom view controller I can't go back to the UIImagePickerController's thumbnail view. Is there a way to extend the UIImagePickerController so you return to the UIImagePickerController when canceling the custom view controller?

Thanks!

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

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

发布评论

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

评论(1

鹊巢 2024-09-16 10:52:19

UIImagePickerController 是一个 UINavigationController。这意味着您可以根据需要将内容推送到堆栈中或将其弹出。无需设置新的视图控制器,只需将控制器推入图像选择器堆栈即可。

UIImagePickerController is a UINavigationController. That means you can push and pop things onto the stack all you want. Instead of setting a new view controller, just push your controller onto the image picker stack.

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