简体   繁体   中英

Method of UINavigationController to add a view controller to navigation stack?

UINavigationController的哪种方法用于将视图控制器快速添加到导航堆栈?

Normally, the following method is used to push UIViewController to UINavigationController 's navigation stack

pushViewController(_ viewController: UIViewController, animated: Bool)

This is implemented inside your CustomViewController class in the following way:

let someVC: CustomViewController = CustomViewController() // this is one way of initializing it
self.navigationController?.pushViewController(someVC, animated: true)

The following is another method which can be used to add a UIViewController to UINavigationController stack

setViewControllers(_ viewControllers: [UIViewController], animated: Bool)

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.

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