首页 > 开发 > iOS > 正文

tabBar中tabBarItem选中颜色自定义设置

2018-03-22 10:24:56  来源: 网友分享
  1. 在storyBoard中,选中tabBarController,设置tabBar中KeyPath中的(selectedImageTintColor)如图

image.png


2. 直接代码设置

tabBarController.tabBar.selectedImageTintColor = [UIColor orangeColor];

 

修改tabBarItem的字体颜色:

[tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor],NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];