iOS 7.1 issue - Tabbar icon image is automatically resize when touch and drag on that tab button

SaintTail picture SaintTail · Mar 13, 2014 · Viewed 26.8k times · Source

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 enter image description here

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 enter image description here

how can this happen? is there anyway to solve this?

Thanks.

Answer

wrightak picture wrightak · Apr 4, 2014

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.