我正在从像这样的照片库中选择一张图片
UIImagePickerController *pickerLibrary = [[UIImagePickerController alloc] init];
pickerLibrary.delegate = self;
pickerLibrary.allowsEditing = YES;
pickerLibrary.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:pickerLibrary animated:YES completion:NULL];
并加载图像我这样做
- (void) imagePickerController:(UIImagePickerController *)pickerLibrary didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
NSLog(@"picked image: %@", image);
self.img = image;
}
会导致以下错误
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [160 nan]'
我一直在寻找,但找不到任何解决我问题的方法。想法?可能很简单?
答案 0 :(得分:0)
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
来自我拍摄照片代码的早期版本。现在看起来它正常工作
答案 1 :(得分:0)
试试这个
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[self dismissViewControllerAnimated:YES completion:^{
UIImage *image=[info objectForKey:UIImagePickerControllerEditedImage];
self.img = image;
}];
}