首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >presentModalViewController:动画在ios6中已弃用

presentModalViewController:动画在ios6中已弃用
EN

Stack Overflow用户
提问于 2013-04-08 16:01:07
回答 4查看 72.7K关注 0票数 101

我正在使用下面的代码来实现图像拾取器。但是当我在模拟器中运行它时,我有一个内存泄漏,并且我得到了一个关于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];
}
EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2013-04-08 16:03:00

使用此行检查(&C):

[self presentViewController:imagePicker animated:YES completion:nil];
票数 217
EN

Stack Overflow用户

发布于 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];
票数 17
EN

Stack Overflow用户

发布于 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];
}
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15874094

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档