使用方法请见Demo
// 字体颜色
dict = NSDictionary(
object: UIColor.init(red: 0.835,green: 0.090,blue: 0.125,alpha: 1.000),forKey: NSForegroundColorAttributeName
);
// 字体大小
var dict = NSDictionary(object: UIFont.systemFontOfSize(12),forKey:NSFontAttributeName
);
// 选中状态下 文字颜色
childCtrl.tabBarItem.setTitleTextAttributes(字典 as? [String : AnyObject],forState: .Selected);
也可以在tabbarController这里面设置
// 视图将要显示
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated);
for item in tabBar.items! {
// 设置字体大小 let dict = NSDictionary(object: UIFont.systemFontOfSize(22),forKey:NSFontAttributeName ); item.setTitleTextAttributes(dict as? [String : AnyObject],forState: .Normal); } }