Edit image after taking a picture

前端 未结 2 785
粉色の甜心
粉色の甜心 2021-02-01 11:16

I\'m currently making an iphone app where the user takes a photo or select it from an album, then an overlay is placed over the image. The user can then scale, rotate and save t

2条回答
  •  逝去的感伤
    2021-02-01 11:32

    there's a way don't change your code much:

    - (IBAction)takePicture:(id)sender {
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
        [imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
    } else {
        [imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
    }
    
    [imagePicker setAllowsEditing:YES];
    [imagePicker setDelegate:self];
    
    //place image picker on the screen
    [self presentViewController:imagePicker animated:YES completion:nil];
    }
    

    If you want to use the image that after editing, please change "UIImagePickerControllerOriginalImage" to "UIImagePickerControllerEditedImage", that's it!

提交回复
热议问题