Ios UIImagePickerController未将图像分配给uiimageview

Ios UIImagePickerController未将图像分配给uiimageview,ios,objective-c,uiimagepickercontroller,Ios,Objective C,Uiimagepickercontroller,我正在尝试使用UIImagePickerController并将图像保存到UIImageView,但图像是否未保存 - (IBAction)handleAvatarTap:(id)sender { DLog(@""); UIImagePickerController * picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControl

我正在尝试使用UIImagePickerController并将图像保存到UIImageView,但图像是否未保存

- (IBAction)handleAvatarTap:(id)sender {
DLog(@"");

UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:picker animated:YES];
}

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

[picker dismissModalViewControllerAnimated:YES];
UIImage* original =[info objectForKey:@"UIImagePickerControllerOriginalImage"];

// This is the line that sets the image but the original image assigned to it is still there?
[self.avatarImage setImage:[UIImage imageWithCGImage:original.CGImage]];


}

你确定avatarImage是init吗

比如:

self.avatarImage = [[[UIImageView alloc] initWithFrame:myFrame] autorelease];
self.avatarImage.image = original;

将“用户交互”设置为“已启用”,它现在就可以工作。

是原始版本!=设置时为零?这与图像视图的图像属性是否更新有什么关系?但问题与解除视图控制器无关。请把问题再读一遍。问题是图像视图没有用所选图像更新。我是发布问题和答案的人。这是我唯一改变的事情,它起作用了。这可能与我正在锁定和解锁编辑功能有关!很抱歉我没有注意到这个答案,原来的问题来自同一个人。我将撤销我的否决票,尽管这个答案确实不清楚它是如何解决这个问题的。您可能很清楚,但没有人稍后再看。您是否验证了
self.avatarImage
不是
nil