允许 UIImagePickerController 编辑视频但不能编辑图像
在 Whatsapp 中上传图像或视频似乎使用 UIImagePicker
。
可以在该视图中编辑视频,但无法编辑图像。似乎在SDK中,allowsEditing
属性决定是否允许对图像和视频进行编辑。
我怎样才能获得像Whatsapp一样的行为,其中视频可以编辑但图像不能?
Uploading an image or video in Whatsapp, seems to use a UIImagePicker
.
It's possible to edit video in that view, but images can't be edited. It seems that in the SDK, the allowsEditing
property determines whether editing is allowed for both images and video.
How can I get the behavior like Whatsapp, where video can be edited but images cannot?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我能够通过监听来自选择器的通知来实现此功能。在 ViewDidLoad 中注册
然后确定何时允许编辑
I was able to achieve this functionality by listening for notifications from the picker. Sign-up in ViewDidLoad
Than determine when to allowing editing
要禁止图像编辑,请设置
allowsEditing = false
。要允许视频编辑,请在
UIVideoEditorController
中呈现所选视频。或者使用您可以根据自己的喜好进行配置的自定义图像/视频选择器。
To disallow image editing set
allowsEditing = false
.To allow video editing, present the picked video in a
UIVideoEditorController
.Or use a custom image / video picker that you can configure to your liking.