繁体   English   中英

iOS-来自另一个呈现的ViewController的呈现ViewController

[英]iOS - Present viewcontroller from another presented viewcontroller

我有3个视图控制器ABC。 B出现在A上 我需要的是在按钮B上单击B并关闭B时,在A上显示C。 但是我做不到。 有一些解决方法。 感谢帮助。

在iOS5中单击B上的按钮,

UIViewController *presentingVC = self.presentingViewController;
[self dismissViewControllerAnimated:YES completion:^{
      [presentingVC presentViewController:vc3 animated:YES completion:nil];
}];

当您单击B上的按钮时,弹出B本身并使用NSNotificationCenter向A发出通知,使A按下C。

如果您不想设置委托,只需通过B内部的presentingViewController属性获取A,则调用所需的A方法,在该方法中首先关闭模态控制器,然后显示C。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM