How to set the title of UIButton as left alignment?

后端 未结 12 2030
感动是毒
感动是毒 2020-11-27 08:34

I need to display the email address from left side of a UIButton, but it is being positioned in the centre.

Is there any way to set the alignment to the

12条回答
  •  隐瞒了意图╮
    2020-11-27 09:24

    Swift 4+

    button.contentHorizontalAlignment = .left
    button.contentVerticalAlignment = .top
    button.contentEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
    

提交回复
热议问题