I'm able to set finished selected and unselected images for all the other tabs, but not for the "More" item which is special.
How can i do this?
Here is the current code:
[[UITabBar appearance] setTintColor:contrastColor];
[[UITabBarItem appearance] setTitleTextAttributes:@{UITextAttributeTextColor: contrastColor, UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 0)]} forState:UIControlStateSelected];
[[UITabBarItem appearance] setTitleTextAttributes:@{UITextAttributeTextColor: contrastColor, UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 0)]} forState:UIControlStateNormal];
contrastColor
is white and delivered from our backend system.
I don't know if this is an option for you or not, but you can try find a "More" image similar to the one you are using instead of using Apple's, which I am assuming you are using; if not just ignore me.
Then just do this:
UITabBarItem *tabBarItem4 = [[tabViewController.tabBar items] objectAtIndex:3];
[tabBarItem4 setFinishedSelectedImage:[UIImage imageNamed:@"tabbar-more-selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"tabbar-more-normal"]];
Have you tried with this?
tabBarController.tabBar.barTintColor = yourBarColor;
tabBarController.tabBar.tintColor = yourSelectedIconAndTextColor;
And for different states:
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFont fontWithName:yourFontName size:yourFontSize], NSForegroundColorAttributeName: yourSelectedIconAndTextColor} forState:UIControlStateSelected];
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:yourFontName size:yourFontSize], NSForegroundColorAttributeName:[UIColor defaultColor]} forState:UIControlStateNormal];
Hope it helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.