4

Is there a way to make a the UITabBar show just images that fill the entire TabBarItem? I tried simply placing an image and deleting the text in the item's title but the image always appears off-center (the area where the title text was remains and I can't align the image to be over it)

Gil
  • 559
  • 6
  • 18

1 Answers1

3

Change image inset of UITabBarItem in UITabBar. You could adjust the image inset to make image bigger, smaller, shift to right etc.

Abdullah
  • 7,143
  • 6
  • 25
  • 41
  • Tried that, the vertical inset does not work past the area where the title text was. I can use it to move the image further up but that is not what I want. – Gil Mar 31 '15 at 18:23
  • I tried it using the controls in the storyboard as well as programically – Gil Mar 31 '15 at 18:46
  • It is difficult to say without looking at code or Storyboard. I tried in a test project in Storyboard and it seems to be working fine for me. – Abdullah Mar 31 '15 at 18:47
  • correction, the inset works but it causes a wired visual bug. When I run the app on my phone and tap the TabBarItem, if I hold my finger down on the tabbarimage and move it around it causes the image to grow bigger... So strange. – Gil Mar 31 '15 at 20:16
  • 3
    The trick is to set BOTH top and bottom insets, making one the negative value of the other (eg. UITabBarItem.imageInsets.top = 5 AND UITabBarItem.imageInsets.bottom = -5). ALSO, remember to do this BEFORE adding the image. – Benjamin Jul 08 '16 at 12:45