2014-02-09 51 views
1

我有我從照片庫中選取圖像這樣空(無)的UIImage從照片庫中挑選

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

OK,這個問題似乎是,我已經忘記了,從我的拍照代碼的早期版本刪除舊

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 

。現在,它看起來像它的正常工作

0

試試這個

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{ 
[self dismissViewControllerAnimated:YES completion:^{ 
    UIImage *image=[info objectForKey:UIImagePickerControllerEditedImage]; 
    self.img = image; 
}]; 
} 
相關問題