您的位置:首页 > 移动开发 > Swift

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

2015-08-20 11:53 274 查看
操作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]

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: