最佳答案
我使用下面的代码为一个图像选择器。但是当我在模拟器中运行它时,我有一个内存泄漏,并且我得到一个关于在 iOS6中弃用 presentModalViewcontroller:animated
的警告。我也得到 dismissModalViewController:animated
弃用。我用的是 SDK 6.1。
ImagePicker 代码:
- (void)showAlbum:(id)sender {
imagePicker=[[UIImagePickerController alloc]init];
imagePicker.delegate = self;
imagePicker.allowsEditing =NO;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:imagePicker animated:YES];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
//release picker
[picker dismissModalViewControllerAnimated:YES];
}