0

I have programmatically set up a UITabBarController with 3 views, but the icons in the UITabBar aren't looking like what I wanted them to. Is there a way to programmatically resize/move them?

Fabio
  • 3,015
  • 2
  • 29
  • 49

1 Answers1

1

The icons in the UITabBar are instances UITabBarItem which is a subclass of UIBarItem.

UIBarItem has a property called imageInsets which I think is exactly what you are looking for.

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIBarItem_Class/Reference/Reference.html#//apple_ref/occ/cl/UIBarItem

I imagine the code will look something like:

UIEdgeInsets insets = {
    .top = 3,
    .left = 0,
    .bottom = 4,
    .right = 3
};

self.tabBarItem.imageInsets = insets;

You could also just try modifying the raw image file so it sits better in the space.

Awais Hussain
  • 98
  • 1
  • 2
  • 8