加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Swift/OC设置tabbar

发布时间:2020-12-14 07:04:04 所属栏目:百科 来源:网络整理
导读:Swift-Demo演示点此下载 OC -Demo演示点此下载 使用方法请见Demo // 字体颜色 dict = NSDictionary( object: UIColor.init(red: 0.835,green: 0.090,blue: 0.125,alpha: 1.000),forKey: NSForegroundColorAttributeName ); // 字体大小 var dict = NSDiction

Swift->Demo演示点此下载


OC ->Demo演示点此下载



使用方法请见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); } }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读