Lukas
Lukas

Reputation: 713

IOS 7.1 UITabBarItem titlePositionAdjustment and imageInsets

For previous versions of iOS 7 when I needed to shift the position of the title and image (usually an icon) on a UITabBarItem two settings were required.

myViewController.tabBarItem.imageInsets = UIEdgeInsetsMake(0, -15, 0, 15); myViewController.tabBarItem.titlePositionAdjustment = UIOffsetMake(-15, 0);

This however introduced double the inset size for the image since the 7.1 update of iOS. Below is an answer based on my findings.

Upvotes: 4

Views: 2962

Answers (1)

Lukas
Lukas

Reputation: 713

The first line from above is no longer required as the line

myViewController.tabBarItem.titlePositionAdjustment = UIOffsetMake(-15, 0);

now also moves the image appropriately.

Upvotes: 6

Related Questions