I push a UIViewController twice in rootViewController(one by one) Now I want to back to rootviewcontroller and open a new UIViewController ,What shall I do? I can use notification to achieve it ,but I really want to know a good way to achieve it .
首先,我创建一个新的UIViewController,然后将其添加到navigationController的viewControllers中,至少我使用popToViewController转到新的UIViewController
Think about it as a stack. First you in rootViewController, then you push two viewController in front of it.
All you need is
func popViewController(animated: Bool) -> UIViewController?
So all you need is to pop twice to go back to rootViewController.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.