开发者

Is it safe to call dismissModalViewControllerAnimated within a modal view on iOS?

开发者 https://www.devze.com 2023-01-16 02:03 出处:网络
Is it safe to call dismissModalViewControllerAnimated within a modal view? or should it be called from the controller th开发者_开发知识库at initiated the modal view? If so how would I program that?The

Is it safe to call dismissModalViewControllerAnimated within a modal view? or should it be called from the controller th开发者_开发知识库at initiated the modal view? If so how would I program that?


The documentation does not make it clear what's going on (e.g. is it safe to do [self.parentViewController.parentViewController dismissModalViewControllerAnimated:NO]?), but in my testing you can dismiss the modal VC from either itself or its parent:

  • From either VC, you can do [self dismissModalViewControllerAnimated:NO]
  • From the parent VC, you can do [self.modalViewController dismissModalViewControllerAnimated:NO]
  • From the modal VC, you can do [self.parentViewController dismissModalViewControllerAnimated:NO]
0

精彩评论

暂无评论...
验证码 换一张
取 消