thisiscrazy4
thisiscrazy4

Reputation: 1965

Text in UISegmentedControl not exactly centered?

Maybe it's just me, but it seems like the bottom padding is greater than the top padding for the text in this UISegmentedControl. Why is this happening?

enter image description here

Upvotes: 0

Views: 1045

Answers (1)

matt
matt

Reputation: 535247

The position is probably correct, but it looks wrong to your eye because room is left for a descender, and there are no descenders because the titles are all caps. Luckily, you can adjust the y-component of the content position! There are two ways:

  • In Interface Builder, in the attributes inspector for each segment, set the Content Offset

  • In code, call setContentPositionAdjustment:forSegmentType:barMetrics:

Upvotes: 1

Related Questions