jin jin - 1 year ago 78
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 Source

You have to use contentVerticalAlignment and contentHorizontalAlignment of the button.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download