jin jin - 4 days ago 5
iOS Question

How to alignment the text of button to the left?

Now I want to alignment the text of button to the left with code , how to do ?
and I code this :

button.titleLabel.textAlignment = UITextAlignmentLeft;


but it doesn't work.

Answer

You have to use contentVerticalAlignment and contentHorizontalAlignment of the button.

Comments