I cannot edit picture using UIImagePickerController in Xcode6

112 views Asked by At

I wrote a application that take pictures from PhotoLibray. When I run the app, it succeed, and then I select a picture from the library, and I set the allowEditing property to YES, but when the edit screen shows, no edit tool show, I cannot edit the picture. I used xcode6, the class is UIImagePickerController. Code is below,

- (IBAction)takePicture:(id)sender
{
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

    // If the device ahs a camera, take a picture, otherwise,
    // just pick from the photo library
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
        imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    } else {
        imagePicker.allowsEditing = YES;
        imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    }

    imagePicker.delegate = self;

    // Place image picker on the screen
    [self presentViewController:imagePicker animated:YES completion:nil];
}

When the edit screen shows, there are 2 buttons, one is "Cancel" and the other is "choose". I press the left mouse button and drag it, but nothing shows, I can only move the picture and when I release the left mouse, the picture return back to the old place.
Why I cannot edit or crop the picture?

2

There are 2 answers

0
Jay On

I was wrong, I can edit it. I search this using Internet, I can move and scale the picture and choose the picture in the square area, then get the picture after edited.The problem was resolved.

2
Rajesh Maurya On

See UIImagePickerController allowsEditing will only allow you to crop image. It does nothing more. If you want to add more editing features you should implement by your self.