I tried to use:
button.titleLabel?.textAlignment = .left
to left align the text on a button, but the text still appears in the centre. I don't have any code to set the title of the button to the centre of the button so it must do that by default.
Can anyone tell me how to use the textAlignment
property on the titleLabel
of the button for left alignment?
Edit: To address the proposals to close the question, you can if you see fit to do so, but my question is not the same as simply asking how to left align the text in a button. I asked how to use a specific property (titleLabel) to do so, which I believe has not been asked before. And I received a quality answer which answered my question.