首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用presentModalViewController后无法删除UIView

使用presentModalViewController后无法删除UIView
EN

Stack Overflow用户
提问于 2012-05-31 05:29:43
回答 1查看 1.3K关注 0票数 0

我使用一个presentModalViewController来呈现一个视图,然后在我尝试使用removeFromSuperview删除一个UView之后,它不再工作了。

在我使用presentModalViewController命令之前,从superview中删除in视图是没有问题的。

什么改变了?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-05-31 06:55:42

首先,presentModalViewController已被弃用,因此您不应该使用它。

根据UIViewController class reference,您应该改用presentViewController:animated:completion:

其次,如果您使用任何present??ViewController方法,为了消除它,您应该像这样使用适当的dismiss??ViewController

代码语言:javascript
复制
// Present the view controller
[self presentViewController:viewController animated:YES completion:NULL];

// Later, to dismiss it:
[self dismissViewControllerAnimated:YES completion:NULL];
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10824543

复制
相关文章

相似问题

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