UIImagePicker允许编辑卡在中心 [英] UIImagePicker allowsEditing stuck in center

查看:763
本文介绍了UIImagePicker允许编辑卡在中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIImagePicker适用于某种类型的UIImagePickerControllerSourceTypePhotoLibrary,但是当我使用UIImagePickerControllerSourceTypeCamera时,编辑框无法从图像的中心移动。因此,如果图像高于宽度,则用户无法将编辑框移动到图像的顶部正方形。

I have a UIImagePicker that works perfect for a type of UIImagePickerControllerSourceTypePhotoLibrary, but when I use UIImagePickerControllerSourceTypeCamera, the editing box cannot move from the center of the image. So if the image is say taller than it is wide, the user cannot move the editing box to the top square of the image.

任何人都知道为什么会出现这种情况?它只发生在来自相机而不是库的情况下。

Anyone know why this would be the case? It only happens when the source is from the camera, not the library.

编辑:一些代码!!!

Some CODE!!!

if (actionSheet.tag == 2) {
    if (buttonIndex == 0) { // Camera
        // Check for camera
        if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == YES) {
            // Create image picker controller
            UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

            // Set source to the camera
            imagePicker.sourceType =  UIImagePickerControllerSourceTypeCamera;
            imagePicker.allowsEditing = YES;

            // Delegate is self
            imagePicker.delegate = self;

            // Show image picker
            [self presentViewController:imagePicker 
                               animated:YES 
                             completion:^(void) {
                             }];
        }
    }
    else if (buttonIndex == 1) { // Photo Library
        if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary] == YES) {
            // Create image picker controller
            UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

            // Set source to the camera
            imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            imagePicker.allowsEditing = YES;

            // Delegate is self
            imagePicker.delegate = self;

            // Show image picker
            [self presentViewController:imagePicker 
                               animated:YES 


                          completion:^(void) {
                                 }];
            }
}

所以你可以看到,我把它们显示出来相同,但相机编辑的行为与照片库编辑不同。

So as you can see, I display them the exact same, but the camera edit acts differently than the photo library edit.

推荐答案

看起来这种行为只是iOS 6中的一个错误... ...基本上你不能移动编辑框,除非你放大一点,它总是反弹到中间。希望他们能很快解决这个问题。

Looks like this behavior is just a bug in iOS 6... Basically you cannot move the editing box, it always bounces back to the middle unless you zoom in a bit. Hopefully they fix that soon.

这篇关于UIImagePicker允许编辑卡在中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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