繁体   English   中英

iOS-拥有一个不错的popToRootViewController并打开一个新的UIViewController

[英]iOS - Have a good popToRootViewController and open a new UIViewController

我在rootViewController中(一次一个)推入两次UIViewController现在我想回到rootviewcontroller并打开一个新的UIViewController,我该怎么办? 我可以使用通知来实现它,但是我真的很想知道一种实现它的好方法。

首先,我创建一个新的UIViewController,然后将其添加到navigationController的viewControllers中,至少我使用popToViewController转到新的UIViewController

将其视为堆栈。 首先,您在rootViewController中,然后在其前面推送两个viewController。

所有你需要的是

func popViewController(animated: Bool) -> UIViewController?

因此,您需要弹出两次以返回到rootViewController。

暂无
暂无

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

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