簡體   English   中英

UIImagePickerController allowEditing = YES不起作用

[英]UIImagePickerController allowsEditing = YES not working

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;

switch (buttonIndex) {
    case 0:
    {
        imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
        imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
        [self presentViewController:imagePicker animated:YES completion:nil];
    }
        break;
    case 1:
    {
        imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        [self presentViewController:imagePicker animated:YES completion:nil];
    }
        break;
    case 2:
    {
        [actionSheet removeFromSuperview];
    }
            break;
        default:
            break;
    }
}

拍照時無法拖動照片,但是UIImagePickerControllerSourceTypePhotoLibrary中的照片可以編輯

在此處輸入圖片說明

試試這個代碼。 它可以在前后攝像頭模式下為我工作。

UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate =自我;

    if (buttonIndex==0) {
        if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
            imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
            imagePicker.mediaTypes = @[(NSString *) kUTTypeImage];
            imagePicker.allowsEditing = YES;
            [self presentViewController:imagePicker animated:YES completion:nil];

        }

    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM