I have this code
[tabBarItem1 setFinishedSelectedImage:[UIImage imageNamed:@"tab_pressed_home_icon"] withFinishedUnselectedImage:[UIImage imageNamed:@"tab_home_icon"]];
tabBarItem1.imageInsets = UIEdgeInsetsMake(8, 0, -2, 0);
which set an icon on the tab bar.
everything work fines so far until last night that i update Xcode 5.1
and run the app on ios7.1 simulator.
here is the app
now when i tap the tab bar the icon image size is decrease an when i release the finger image is back to normal. But if i tap the icon and drag it the image is look like this (scale down).
like this
how can this happen? is there anyway to solve this?
Thanks.
This problem was resolved by setting the imageInsets of the tabBarItem as others have mentioned. You can do this in code or you can do it in Interface Builder, it doesn't matter.
The important point is to have the top inset BE EQUAL to the bottom inset.
I had the same problem on iOS 7.1 when trying to set the Image insets by code like:
[self.tabBarItem setImageInsets:UIEdgeInsetsMake(5, 0, -5, 0)];
So I solved it using directly the Bar Item Size on my Storyboard.
Take in count that for this to work you should be assigning the image of you TabBarItem in the following way
UITabBar *tabBar = self.tabBarController.tabBar;
UITabBarItem *myItem = [tabBar.items objectAtIndex:0];
[homeItem setFinishedSelectedImage:[UIImage imageNamed:@"A.png"]
withFinishedUnselectedImage:[UIImage imageNamed:@"B.png"]];
instead of this way
[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"A.png"]
withFinishedUnselectedImage:[UIImage imageNamed:@"B.png"]];
Update
To access the Bar Item Size select directly the 'Item' element under the Scene of any of your Tab Bar Controller's child. (Image1)
my problem is similar, the tabbar icon changed it position in 7.1 update, this problem is really annoying, and I did a quick solution because I have to approve the app. Was this:
Ok I not sure that is the best solution, but for me works.
Same problem here. Also after update to iOS 7.1 and xcode 5.1 My solution: The tab bar item size was set at 4 for Bottom.(in Size inspector) I changed it to 0 like all the others and the problem was gone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With