Skip to content

Instantly share code, notes, and snippets.

@muhlenXi
Last active November 23, 2018 01:43
Show Gist options
  • Save muhlenXi/88291978d0b595cea3e067f83d639486 to your computer and use it in GitHub Desktop.
Save muhlenXi/88291978d0b595cea3e067f83d639486 to your computer and use it in GitHub Desktop.
设置 Navigationbar 的相关属性
func setNavigationBarAttributes() {
//设置NavgationBar title 字体 和 颜色
var titleTextAttributes = Dictionary<String, Any>()
titleTextAttributes[NSForegroundColorAttributeName] = UIColor.black
titleTextAttributes[NSFontAttributeName] = UIFont.systemFont(ofSize: 16)
self.navigationController?.navigationBar.titleTextAttributes = titleTextAttributes
//设置NavgationBar的背景颜色
self.navigationController?.navigationBar.barTintColor = UIColor.white
//设置NavgationBar的Item的颜色
self.navigationController?.navigationBar.tintColor = UIColor.black
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment