简体   繁体   English

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

[英]iOS - Present viewcontroller from another presented viewcontroller

I have 3 view controllers, A , B and C . 我有3个视图控制器ABC。 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.

相关问题 如何将数据从模态呈现的ViewController传递到Xamarin.iOS中的另一个ViewController? - How to pass the data from modally presented ViewController to another ViewController in Xamarin.iOS? 从另一个 ViewController 呈现故事板 ViewController - Present storyboard ViewController from another ViewController 从另一个ViewController呈现TabBarController - Present TabBarController from another ViewController 通过代码呈现的另一个ViewController呈现AlertController - Present AlertController Over another ViewController presented via code IOS 5 - 从另一个ViewController调用ViewController - IOS 5 - Call a ViewController from another ViewController 在另一个模态呈现的viewController下模糊viewController? - Blurring viewController underneath another modally presented viewController? ViewController由另一个ViewController呈现后崩溃 - Viewcontroller crashes after being presented by another viewcontroller 关闭一个ViewController并显示另一个ViewControlloer-IOS-Swift 3 - Dismiss a ViewController and present another ViewControlloer - IOS - Swift 3 iOS 如何从 Uiview 呈现 Modal ViewController - iOS how present Modal ViewController from Uiview 如何从呈现的 ViewController 推送? - How to Push from presented ViewController?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM