所以我正在重新测试我认为适用于iOS 4.2以及新iOS 5的应用程序之一,出于某种原因,他们不想玩得很好。我的UIImagePicker委托将在用户从照片库中选择照片后,始终发出imagePickerControllerDidCancel,并且永远不允许选择图片(只是说当我尝试加载图片时图片为零)。这是我知道在以前版本的iOS上运行的代码,所以我不知道为什么它现在不起作用,除非Apple改变了UIImagePicker的工作方式。
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage : (UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
mainPhoto.image = image;
[self saveImage:image];
[picker dismissModalViewControllerAnimated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *) picker
{
[picker dismissModalViewControllerAnimated:YES];
}
以下是调用UIImagePicker的代码:
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:picker animated:YES];
[picker release];
有什么想法吗?或者有其他人有这个问题吗?
答案 0 :(得分:4)
文件
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage : (UIImage *)image editingInfo:(NSDictionary *)editingInfo
说,
“ 在iOS 3.0中已弃用。请使用imagePickerController:didFinishPickingMediaWithInfo:改为。 ”。尝试按照建议操作,如果您仍然遇到问题,请告诉我们?