Swift修改navigation bar背景颜色、标题及其颜色

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013440030/article/details/47805839

操作root view controller

//设置导航栏背景颜色

let bgColor = UIColor(red: x/255, green:y/225, blue: z/255, alpha: 1) 

self.navigationController?.navigationBar.barTintColor = bgColor 


//设置标题及其颜色

self.navigationItem.title = "your title" 

let navigationTitleAttribute: NSDictionary = NSDictionary(objectsAndKeys: UIColor.yourcolor, NSForegroundColorAttributeName) 

self.navigationController?.navigationBar.titleTextAttributes = navigationTitleAttribute as [NSObject: AnyObject]

 

展开阅读全文

没有更多推荐了,返回首页