NavigationController常用操作:
- 更改bar的背景颜色:self.navigationController?.navigationBar.barTintColor =UIColor.redColor()
- 设置bar的返回字体的颜色:self.navigationController?.navigationBar.tintColor = UIColor.blueColor()
- 设置中间的标题:self.navigationItem.title="title"
- 设置bar中间字体的颜色:self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
- 设置bar背景透明:self.navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
- // 设置导航背景为白色,不然在切换至子视图时,右上角会黑屏
self.navigationController.view.backgroundColor = UIColor.whiteColor;