0

I want the tab bar of my App for iOS5/6 look just like on iOS7 without using Xcode 5. Is it possible to remove this gloss/shadow effect? I tried the famous -setFinishedSelectedImage:withFinishedUnselectedImage: code solution. But seems not to work with my case. I played around with these codes I have:

UIImage* icon1 = [UIImage imageNamed:@"discover_dg~iphone.png"];
UIImage* icon2 = [UIImage imageNamed:@"discover_lb~iphone.png"];

//UITabBarItem *updatesItem = [[UITabBarItem alloc] initWithTitle:@"Discover" image:icon1 tag:1];

UITabBar *tabBar = self.tabBarController.tabBar;
UITabBarItem *updatesItem = [tabBar.items objectAtIndex:1];
updatesItem.image = icon1;


[updatesItem setFinishedSelectedImage:icon2 withFinishedUnselectedImage:icon1];

[self.navigationController setTabBarItem:updatesItem];

First tab bar icons as the screen loads has the iOS6 look just like this with the glossy effect..

enter image description here

or this with the shadow effect..

enter image description here

I am trying to remove the gloss effect/shadow of the UITabBarItem on iOS5/6. When I click on a particular icon, the blue one will appear and when I leave(which in the unselected one) it will turn to GRAY, the ORIGINAL images which must FROM THE START appeared already as the screen loads/appear. But somehow, I got these set with the glossy ones..

enter image description here

enter image description here

or these with shadows..

enter image description here

enter image description here

Cheers in advance!

rmaddy
  • 314,917
  • 42
  • 532
  • 579
caribbean
  • 748
  • 1
  • 9
  • 29

2 Answers2

2

http://www.appcoda.com/ios-programming-how-to-customize-tab-bar-background-appearance/ This is the best solution.Use the storyboard.You just take the same code to AppDelegare.m Good luck to you!

Jamin Zhou
  • 71
  • 5
1

You can using the appereance protocol, in iOS7 is mostly made using new features, but from iOS5 appereance method make you able to do that.
you just need to change the background (-setBackgroundImage:) image of the tabbar and each UItabbarItem for viewcontrollers from selected to unselected state( -setFinishedSelectedImage:withFinishedUnselectedImage: ).
There is also a tint property if you do not need to apply different image for each VC. Check the doc here

Check also this answer

Community
  • 1
  • 1
Andrea
  • 26,120
  • 10
  • 85
  • 131
  • thanks for the response, but I actually set my tab bar background in the Appdelegate.m file.. I came up with these two sets of effects; first by using tintColor which produces the glossy ones and the other was by using a white image for background that results to those with shadows. One more thing, do you think storyboard is doing something with this. My tabController is initially made in storyboard. – caribbean Aug 29 '13 at 07:12
  • Don't know, never used storyboard, I do almost everything programatically. I was able to achieve what you need setting each single images for selected and unselected UITabbar item, without any shadow effect. – Andrea Aug 29 '13 at 09:18
  • With this case, I guessed nobody knows? Those unwanted effects just show up after the first load. – caribbean Sep 13 '13 at 13:23