通过Swift设置ios下NavigationBar颜色字体的方
- 设置UINavigationBar背景颜色
UINavigationBar.appearance().barTintColor = UIColor(red: 36.0/255.0, green: 190.0/255.0, blue: 139.0/255.0, alpha: 1.0)
- 设置UINavigationBar文本颜色
var attr: NSMutableDictionary! = [NSForegroundColorAttributeName: UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1.0)]
- 设置UINavigationBar字体
attr.setValue(UIFont(name: "AmericanTypewriter", size: 16.0), forKey: NSFontAttributeName)
- 设置UINavigationBar文本阴影
var shadow = NSShadow()
shadow.shadowColor = UIColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0)
shadow.shadowOffset = CGSizeMake(0, 1)
attr.setValue(shadow, forKey: NSShadowAttributeName)
UINavigationBar.appearance().titleTextAttributes = attr
本文标题:通过Swift设置ios下NavigationBar颜色字体的方
本文链接:https://www.haomeiwen.com/subject/bcqwxttx.html
网友评论