我是新来的iPhone和我使用此代码从iPhone库中选择一个图像,并在imageView中显示它。该库显示的图像,但是当我选择图像,它不会出现在图像视图..UIImagePicker不显示选定的图像
- (void)viewDidLoad {
[super viewDidLoad];
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:picker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}
请你能告诉我怎么使用代码的问题?
感谢您的代码....这个代码不工作如果您使用的界面生成器检查您是否正确设置出口仍然没有在我的ImageView – 2009-12-04 10:27:08
得到任何图像:self.imageView可能是零! ;-) – muccy 2009-12-04 11:41:45