微信: 导航控制器控制的界面A
通过按钮点击跳转到扫码界面B
, 扫到二维码跳到界面C
, 界面C
popViewController
会跳转到界面A
func popThenPush(){
//需要推出的控制器
let viewController = UIViewController()
viewController.view.backgroundColor = UIColor.redColor()
//根据需要隐藏tabBar
viewController.hidesBottomBarWhenPushed = true
var viewControllers = self.navigationController?.viewControllers
viewControllers?.removeLast()
viewControllers?.append(viewController)
self.navigationController?.setViewControllers(viewControllers!, animated: true)
}