使用GKImagePicker裁剪照片

时间:2013-07-25 09:17:46

标签: ios photo

我想裁剪在应用中拍摄的照片然后保存。我正在使用GKImagePicker,所以我可以这样做,但如果我使用下面的代码,即使我在我的应用程序中按下拍照按钮,它会显示我选择要剪切的照片库。我不想这样做,只想裁剪我在应用程序中拍摄的照片。

- (IBAction)takePhoto:(UIButton *)sender {

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    self.imagePicker = [[GKImagePicker alloc] init];
    self.imagePicker.cropSize = CGSizeMake(320, 320);
    self.imagePicker.delegate = self;


    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentModalViewController:self.imagePicker.imagePickerController animated:YES];
    [self presentViewController:picker animated:YES completion:NULL];

}

1 个答案:

答案 0 :(得分:0)

删除代码中的最后一行:

[self presentViewController:picker animated:YES completion:NULL];// remove

并尝试一下;)

您还可以查看this