- (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];
}
大家好! :D我有这段代码。我正在使用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
有什么建议吗?我已经堆了好几个小时了,我的想法也用完了。
谢谢!