我将以下代码用于图像选择器。但是当我在模拟器中运行它时,我遇到了内存泄漏,并且我收到了关于presentModalViewcontroller:animated
在 iOS6 中被弃用的警告。我也被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];
}