swift - 导航栏设置

话不多,直接贴代码:

 let nav = UINavigationController.init(rootViewController: viewController)

        nav.topViewController?.title = title// 设置导航栏的标题

        nav.navigationBar.tintColor = .whiteColor()// 设置push出的导航栏的返回颜色(箭头及文字)

 

        UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()]// 设置标题颜色

        UINavigationBar.appearance().barTintColor = UIColor(hexString: mainColorHexString)// 设置背景颜色

 

 

posted on 2016-06-08 17:31  XHShare  阅读(928)  评论(0编辑  收藏  举报

导航