Chelsea Shawra Chelsea Shawra - 3 years ago 116
iOS Question

UIButton title alignment not changing to right direction in RTL

I am having an application in both LTR and RTL languages. Everything is fine but the UIButton title alignment is not changing to right though the UIButton flips itself.
Here is the screenshot:
UIButton in RTL

Alignment Given

Constraints given for default language english:

Constraints given for default language english:

What is the issue and why it happens? Do we need to set the title programatically aligned to right?

Answer Source

Use right alignment from storyboard as

enter image description here

or from programmatically as

buttonShowOnMap.contentHorizontalAlignment = .left//For left alignment

buttonShowOnMap.contentHorizontalAlignment = .right//For right alignment
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download