上下跳转_TO:
上下跳转_BACK:
-----------------------------------------------
-----------------------------------------------
左右跳转_TO:
(将新的视图控制器PUSH到navigationController中,相当于入栈操作)
copy
self.navigationController!.pushViewController(secondViewController,255); background-color:inherit; font-weight:bold">true)
左右跳转_BACK:
(将当前视图控制器从导航视图控制器堆栈中移除,从而返回到了上一级界面)
( - ) BACK_到上一级:
copy
letfirstViewController=FirstViewController()
self.navigationController?.popViewControllerAnimated(true)
( - )BACK_指定界面:
copy
//获得视图控制器中的某一视图控制器
letviewController=self.navigationController?.viewControllers[0]
self.navigationController?.popToViewController(viewControlleras!UIViewController,255); background-color:inherit; font-weight:bold">true)
( - )BACK_根视图:
根视图的设置需要在AppDelegate中设置:
copy
varwindow:UIWindow?
funcapplication(application:UIApplication,didFinishLaunchingWithOptionslaunchOptions:[NSObject:AnyObject]?)->Bool
{
varfirstViewController=FirstViewController()
varrootNavigationViewController=UINavigationController(rootViewController:firstViewController)
self.window!.rootViewController=rootNavigationViewController
returntrue
}
原文链接:https://www.f2er.com/swift/321089.html