Reputation: 7110
I have a table view cell and I have a label and button vertically aligned in vertical stack view. I want the text on UIButton to start right below UILabel. But even if I set the contentHorizontalAlignment on button to left, it still doesn't start from right below the label. I want 'S' of 'Select' right below 'L' of 'Label'. How do I achieve it?
Code:
self.selectPersonButton.contentHorizontalAlignment = .left
Upvotes: 0
Views: 626
Reputation: 66
By default buttons has content insets
, you must change them to custom
, to be able to set you own if you need.
in the picture shown the place of that configuration, change it to custom
and set all insets to 0 , like in picture below.
Everything will work as you expect.
As an information starting from iOS 15
Apple added new way of configuring buttons, apple document Button.Configuration
Upvotes: 0