赞
踩
效果图
代码如下
// 在第一个控制器中添加如下代码
self.title = "改变字体颜色"
tabBarItem.image = UIImage(named: "home_black_icon")
tabBarItem.selectedImage = UIImage(named: "home_line_icon")?.withRenderingMode(.alwaysOriginal)
// 改变字体的颜色
tabBarItem.setTitleTextAttributes([NSForegroundColorAttributeName : UIColor.red], for: .highlighted)
// 在第二个控制器中添加如下代码
self.title = "改变字体大小"
tabBarItem.image = UIImage(named: "user_line_icon")
tabBarItem.selectedImage = UIImage(named: "user_black_icon")?.withRenderingMode(.alwaysOriginal)
// 改变字体大小
tabBarItem.setTitleTextAttributes([NSFontAttributeName : UIFont.systemFont(ofSize: 18)], for: .normal)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。