[英]iOS - Present viewcontroller from another presented viewcontroller
I have 3 view controllers, A , B and C . 我有3个视图控制器A , B和C。 B is presented on A . B出现在A上 。 What I need is to present C on A when a button clicked on B and dismiss B . 我需要的是在按钮B上单击B并关闭B时,在A上显示C。 But I am unable to do so. 但是我做不到。 Is there some workaround. 有一些解决方法。 Thanks for help. 感谢帮助。
click the button on B, in iOS5, 在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.