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にはこのコードがあります。私は setallowedediting: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