Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedded fonts in iOS: why are they not centered correctly on the y axis?

I've embedded a couple fonts in my iOS app and am finding that they're not centered correctly in labels and buttons, they're too high on the y axis, is there any solution for this? At first I thought it was just a cheap font file I was using but then I tried it (just to see) with an Adobe font and it still has the issue.

like image 639
Shizam Avatar asked Mar 15 '11 23:03

Shizam


1 Answers

The (a?) solution a friend of mine pointed out is to use the contentEdgeInsets property of the button, I set it to:

myButton.contentEdgeInsets = UIEdgeInsetsMake(10, 0, 0, 0);

To bump the text down 10 pixels and now the text is centered. Woot.

like image 149
Shizam Avatar answered Oct 17 '22 22:10

Shizam