1
- (IBAction)showImagePickerCamera:(id)sender {

    self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self.picker setDelegate:self];
    self.picker.allowsEditing = YES;

    self.customView = [[CustomCameraViewController alloc]initWithNibName:@"CustomCameraViewController" bundle:nil];
    [self.customView setCustomCameraDelegate:self];

    [self presentViewController:self.picker animated:NO completion:nil];
    self.needsToShowImageSource = NO;
    [self performSelector:@selector(customCameraTakeAPicture) withObject:nil afterDelay:3];

    [self.picker setShowsCameraControls:NO];
}

大家好!:DI 有这段代码。我正在使用 setAllowsEditing:YES 和 setShowsCameraControls:NO。但是如果我设置 ShowsCameraControls = NO,uiimagepickercamera 不允许我裁剪图像。我正在使用自定义视图 (CustomCameraViewController) 创建按钮来拍照、选择相机、闪光灯等。这就是我将 ShowsCameraControls 设置为 NO 的原因。当我按下拍照时,我正在打电话

    -(void)customCameraTakeAPicture
{
    [self.picker setShowsCameraControls:YES];
    [self.picker takePicture];
}

这将我带到裁剪视图,但它没有显示正方形。当我按下 USE 时,应用程序崩溃并出现以下错误:

Aug 26 04:42:50 Chad-DePues-iPod Modabound[13518] <Error>: UIImage *PLCreateCroppedImageFromImageWithQuality(UIImage *, CGRect, CGSize, CGInterpolationQuality): failed to create context
2013-08-26 04:42:50.754 Modabound[13518:861b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: croppedImage)'
*** First throw call stack:
(0x31c1f2a3 0x3989d97f 0x31b81313 0x36d538b7 0x36d79307 0x32535e85 0x39cf4311 0x39cf41d8)
libc++abi.dylib: terminate called throwing an exception

有什么建议么 ?我已经为此堆积了好几个小时,但我的想法已经用完了。

谢谢!

4

0 回答 0