Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用图像采集器裁剪照片_Ios_Photo - Fatal编程技术网

Ios 使用图像采集器裁剪照片

Ios 使用图像采集器裁剪照片,ios,photo,Ios,Photo,我想裁剪在应用程序中拍摄的照片,然后保存。我使用的是GKImagePicker,所以我可以这样做,但如果我使用下面的代码,即使我按下应用程序中的拍照按钮,它也会显示我要裁剪的照片库。我不想这样做,只想裁剪我在应用程序中拍摄的照片 - (IBAction)takePhoto:(UIButton *)sender { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.de

我想裁剪在应用程序中拍摄的照片,然后保存。我使用的是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];

}

删除代码中的最后一行:

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


您也可以检查。

杜德,请您添加更多说明您想做什么,您是否需要在不打开照片库的情况下从摄像头拍摄图像后直接对其进行合并?是的,很抱歉解释太少。拍照后不会进行裁剪。它可以移动,但不能正确缩放