1

I'm able to set finished selected and unselected images for all the other tabs, but not for the "More" item which is special.

screenshot

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.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Maciej Swic
  • 11,139
  • 8
  • 52
  • 68
  • Close vote as off topic? Are you kidding me? – Maciej Swic Oct 23 '13 at 11:46
  • Dear Friend's you can not able to do any changes with more button because it's in-built comes when your tabBar have 5 and more then 5 tanItem.. so best way is stop fighting with it.. :) – iPatel Oct 23 '13 at 11:50
  • Well, you're able to change the text color, and you're able to hack the looks of the tableview controller and navigation bar, so there must be a hack for the icon! – Maciej Swic Oct 23 '13 at 11:55
  • Okay.. But i tried it before some months ago.. you can also search on goole.. may be you will find same answer as my comment :( Al D bSt :) – iPatel Oct 23 '13 at 11:58

2 Answers2

1

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"]];
Chris
  • 1,004
  • 2
  • 11
  • 25
  • Ok, so with a small modification (objectAtIndex:4) this actually worked. Im sure i tried it before without success but it just worked this time. Thanks a lot! – Maciej Swic Oct 24 '13 at 08:07
  • Also, setting the selected image has no effect, but Im happy with the filled white one for this purpose! – Maciej Swic Oct 24 '13 at 08:08
  • Btw, any idea how to make this work in iOS 6 as well? I have created two custom selected and unselected More icons. They work great in iOS 7 but iOS 6 is still gray and blue. – Maciej Swic Oct 24 '13 at 08:37
  • @Maciej Swic: What do you mean selected image has no effect? You use two different files for selected image and unselected image to act as how you need it to. Also, if you're trying to make this look similar in iOS6, you have a few options. – Chris Oct 24 '13 at 16:54
  • Here are two off the top of my head. 1.) Go fully custom! Meaning tab bar background and tab bars have their own images. Here is a pretty good tutorial on iOS 6 customization: http://www.raywenderlich.com/21703/user-interface-customization-in-ios-6 2.) Use UI7Kit found here: https://github.com/youknowone/UI7Kit I've never used it but heard good things about it. Hope this helps. Good luck and happy coding. – Chris Oct 24 '13 at 16:57
  • It seems like iOS 7 was using my selected image as a template. I set it to original rendering mode and all is good now. Thanks again! – Maciej Swic Oct 25 '13 at 07:22
0

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!

RFG
  • 2,880
  • 3
  • 28
  • 44
  • Yes, that's how Im setting my current white and purple appearance. Unfortunately it doesn't seem to affect the unselected state of the "More" item. Sorry for not being more clear about this in the question. – Maciej Swic Oct 23 '13 at 13:00
  • Have you set self.tabBarController.tabBar.translucent = false;? – RFG Oct 23 '13 at 13:23
  • I tried it just now but it doesn't make any difference. Except for moving the image a bit since it affects the autolayout. – Maciej Swic Oct 23 '13 at 13:26
  • I don't if you've take a look at this page, may be could be useful: http://stackoverflow.com/questions/19013967/ios-7-navigation-bar-has-no-translucency-why-does-more-tab-look-translucent/19015318#19015318 – RFG Oct 23 '13 at 14:12