//設(shè)置設(shè)置導(dǎo)航欄標題
self.title="主頁"
//設(shè)置導(dǎo)航欄背景色
self.navigationController?.navigationBar.barTintColor=UIColor.grayColor()
//導(dǎo)航欄還可以設(shè)置圖片
self.navigationController?.navigationBar.setBackgroundImage(UIImage(named:?"testnavigationBar"),?forBarMetrics:?UIBarMetrics.Default)
//導(dǎo)航是否透明
self.navigationController?.navigationBar.translucent=false
//隱藏導(dǎo)航欄
self.navigationController?.navigationBarHidden=true
//導(dǎo)航push到新view controller中(左右效果)
let secondViewController = SecondViewController()
self.navigationController!.pushViewController(secondViewController,animated:true)
//返回上一級頁面
let firstViewController = FirstViewController()
self.navigationController?.popViewControllerAnimated(true)
// 獲得視圖控制器中的某一視圖控制器
let?viewController?=self.navigationController?.viewControllers[0]
self.navigationController?.popToViewController(viewController?as!?UIViewController,animated:true)
//導(dǎo)航push到新view controller中(上下效果)
let secondViewController = SecondViewController()
self.presentViewController(secondViewController,animated:true,completion:nil)