0

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

在我使用命令 presentModalViewController 之前,从 superview 中删除 Uiview 没有问题。

发生了什么变化?

4

1 回答 1

4

首先,presentModalViewController不推荐使用,因此您不应该使用它。
根据UIViewController 类参考,您应该presentViewController:animated:completion:改用。

其次,如果您使用任何present??ViewController方法,为了解除它,您应该使用适当的方法,dismiss??ViewController如下所示:

// Present the view controller
[self presentViewController:viewController animated:YES completion:NULL];

// Later, to dismiss it:
[self dismissViewControllerAnimated:YES completion:NULL];
于 2012-05-30T22:55:41.917 回答