UIImagePickerController:如何允许编辑但隐藏裁剪选项 [英] UIImagePickerController: How to allow editing but hide crop option

查看:36
本文介绍了UIImagePickerController:如何允许编辑但隐藏裁剪选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从图库中选择一张图片并为​​要求他/她取消/选择图片的用户显示预览.

I want to pick an image from the gallery and show the preview for a user asking him/her to cancel/chose the image.

我可以使用 allowsEditing 选项来实现这一点,但我想隐藏显示给用户的方形裁剪,而不是我只想在单独的视图中显示所选图像并给他一个取消或选择所选图像的选项.

I can achieve this using the allowsEditing option but I want to hide the square crop that is displayed to the user, instead I just want to show the selected image in a separate view and give him an option to cancel or chose the selected image.

推荐答案

如果您允许编辑媒体,则不能禁用裁剪"选项,但您要做的一件事是获取原始图像,即使用户裁剪选定的图像.请参阅以下文档中提到的 Apple.

You cannot disable the 'crop' option if you are allowing the editing for the media but one thing that you do is to get the original image even if the user crops a selected image. See below Apple mentioned in the documentation.

https://developer.apple.com/documentation/uikit/uiimagepickercontroller/infokey

使用 infoKey 获取原始图像而不是裁剪后的图像.

Use the infoKey and get the originalImage instead of the cropped.

这篇关于UIImagePickerController:如何允许编辑但隐藏裁剪选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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