UIButton title vertical align bottom not working. The button is inside a table cell. I tried several methods.
xib, select button, on the right panel, click on vertical bottom alignment.
xib, select button, on the right panel, select title insets and give amount of title inset.
Although in storyboard, I can see the alignment align correctly on bottom of the button, however, when open in APP, it STILL align centre vertically.
I also try the following code:
// change to .alignBaseline still not working. same effect. questTitleButton.titleLabel?.baselineAdjustment = .none questTitleButton.titleLabel?.numberOfLines = 1 questTitleButton.contentVerticalAlignment = .bottom questTitleButton.contentHorizontalAlignment = .left
All above method DOES NOT WORK. The button is still vertically centred after running the app.
The only way I can make it work is to set a top inset in content insets area.
Now my question is why? I read many posts, but no one have the same problem as I have.
So why I can only align text to bottom of button by setting content insets? Did I miss anything here? Did I do something wrong when setting up the button? I use pure autolayout and create the view in
The button do have a height constraint and there is no constraint conflict or error. Everything seems to be fine.