swift 设置navigationBar titleTextAttributes
<span> </span>//设置navigationBar的背景图片
let backgroundImage = UIImage(named: "navigation_bg")
self.navigationBar.setBackgroundImage(backgroundImage, forBarMetrics: UIBarMetrics.Default)
//字典KeyValue
/*
var attributesDic:Dictionary<NSObject,AnyObject> = {[
NSFontAttributeName:UIFont(name: "Heiti SC", size: 24.0)!,
NSForegroundColorAttributeName:UIColor.whiteColor()
]}()
*/
//设置navigationBar的titleTextAttributes
self.navigationBar.titleTextAttributes = {[
NSForegroundColorAttributeName: UIColor.whiteColor(),
NSFontAttributeName: UIFont(name: "Heiti SC", size: 24.0)!
]}()
本文介绍如何使用Swift为iOS应用的导航栏设置背景图片及标题属性,包括字体和颜色等,实现个性化界面风格。
1219

被折叠的 条评论
为什么被折叠?



