UIButton Text Margin / Padding

后端 未结 9 1332
名媛妹妹
名媛妹妹 2021-01-31 13:39

I have the following layout, and I\'m trying to add a padding to the left and right..

The controls are a disabled UIButton.

9条回答
  •  情深已故
    2021-01-31 14:11

    With the above solutions, some of the text were cut out if you have a border around the button. For instance, a button label named "Delete something" ends up showing "Dele...ing". If you are having this problem, this is the solution:

    aButton.contentEdgeInsets = UIEdgeInset.init(top: 0, left: 8, bottom: 0, right: 8)
    

提交回复
热议问题