2

I am trying to use Helvetica Condensed font in my app. I've overcome problems with it's vertical alignment, by adjusting ascender (as described in this answer).

However, I also have problems with horizontal alignment - the text in UILabel keeps shifting right a bit when text is aligned left (the "length" of the shift depends on how much text is in the label).

I believe it could be solved using the same technique but I don't know which parameter I should adjust.

https://stackoverflow.com/a/8314285/963881

Community
  • 1
  • 1
piobab
  • 1,352
  • 2
  • 13
  • 21

1 Answers1

0

If you want to just move the label without editing the ascender, you could adjust the UIButton contentEdgetInsets property.

yourButton.contentEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);

This line of code would move your label to the right. The inputs are different from CGRects in that it goes (top, left, bottom, right).

Might be a bit of a hack, but it works.

Joshua Dance
  • 8,847
  • 4
  • 67
  • 72