我正在使用下面的代码来实现图像拾取器。但是当我在模拟器中运行它时,我有一个内存泄漏,并且我得到了一个关于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];
}
发布于 2013-04-08 16:03:00
使用此行检查(&C):
[self presentViewController:imagePicker animated:YES completion:nil];
发布于 2013-04-08 16:06:13
[[Picker presentingViewController] dismissViewControllerAnimated:YES completion:nil];
而不是
[[Picker parentViewControl] dismissModalViewControllerAnimated:YES];
和
[self presentViewController:picker animated:YES completion:nil];
而不是
[self presentModalViewController:picker animated:YES];
发布于 2013-11-29 19:29:52
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
{
[self presentViewController:objSignupViewController animated:^{} completion:nil];
}
else
{
[self presentModalViewController:objSignupViewController animated:YES];
}
https://stackoverflow.com/questions/15874094
复制相似问题