如何允许 iPhone 用户“移动和缩放”已选择的照片
我试图复制用户进入已为其选择照片的联系人的编辑模式,然后单击该联系人的照片时看到的功能。操作表会向上滑动,其中包含“拍照”、“选择照片”和“编辑照片”等选项。当您选择“编辑照片”时,会出现一个视图,显示之前选择的照片,顶部有“移动和缩放”按钮,底部有“取消”和“选择”按钮。如何为任何给定的 UIImage 显示“移动和缩放”视图?
明确地说 - 我已经可以使用“拍照”和“选择照片”。我了解如何使用带有 allowedEditing=YES 的 UIImagePickerController 。我说的是这样的情况:用户已经选择了一张照片,后来(可能几天或几周后)决定要编辑该照片。在这种情况下,我想调出“移动和缩放”视图,就像在“联系人”中一样。
有没有隐藏的方法来使用 UIImagePickerController 来做到这一点?或者其他一些内置方法?或者我需要自己构建这个视图?如果我需要自己构建它,有什么指示吗?
谢谢!
I am trying to replicate the functionality that users see when they go into edit mode for a contact for which they have already selected a photo, and then click that contact's photo. An action sheet slides up, with options including "Take Photo", "Choose Photo", and "Edit Photo". When you select "Edit Photo", a view comes up that shows the previously selected photo, with "Move and Scale" on top of it, and Cancel and Choose buttons at the bottom. How do I show this "Move and Scale" view for any give UIImage?
To make it clear - I already have "Take Photo" and "Choose Photo" working. And I understand how to use the UIImagePickerController with allowsEditing=YES. I am talking about the situation where the user has already chosen a photo, and later (perhaps days or weeks later) decides they want to edit that photo. In that case, I want to bring up the "Move and Scale" view, just as can be done in Contacts.
Is there a hidden way to use the UIImagePickerController to do this? Or some other built-in method? Or would I need to build this view myself? If I need to build it myself, any pointers?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有固定的方法可以做到这一点。你必须自己动手。有整个应用程序专门用于自定义图像编辑作为其唯一目的,因此可以完成,但没有预先构建的方法可以进入允许编辑=是的图像选择器编辑屏幕;得到你。
There is no set way to do this. You would have to roll your own. Theres entire apps dedicated to custom image editing as their sole purpose, so it can be done, but no prebuilt way to get to the image picker editing screen that allowsEditing = YES; gets you.
您可以使用新的 Assets Library API 将图像保存到照片库,然后启动 UIImagePicker 并引导用户选择有问题的图像,然后这次进行彻底的编辑...但这非常丑陋。
You could use the new Assets Library API to save the image to the photo library and then fire up UIImagePicker and direct the user to go choose the image in question and to gol-darnit edit it this time... But that's pretty ugly.