Programmatically center icons in a TabBarItem in a UITabBarController
I'm programmatically generating a UITabBarController (instantiating view controllers and assigning them to my UITabBarController's viewControllers array). I don't want titles for my TabBarItems. However, the Ta开发者_JAVA技巧bBarItems by default make space for a title, so my icon images are centered 5 pixels higher than they should be. Is there a programmatic way to "center" i.e. shift or give offsets to the TabBarItem's image?
You can use the imageInsets property to move the frame of the icon.
Unfortunately, there isn't a way to do this (and even if you managed to cheat and find a way to shift this stuff down it would no doubt be denied by Apple during the approval process).
精彩评论