其他分享
首页 > 其他分享> > UIButton设置UIControlContentHorizontalAlignment调整文字对齐方式

UIButton设置UIControlContentHorizontalAlignment调整文字对齐方式

作者:互联网

 

UIButton 继承自UIControl,所以可以对UIControlContentHorizontalAlignment进行设置

        btn.setImage(UIImage.init(named: "unSelected"), for: UIControl.State.normal)
        btn.setImage(UIImage.init(named: "selected"), for: UIControl.State.selected)
        btn.contentHorizontalAlignment = .right

  

https://blog.csdn.net/timtian008/article/details/53611744

标签:named,UIControl,selected,UIControlContentHorizontalAlignment,init,State,UIButton
来源: https://www.cnblogs.com/qingzZ/p/10570070.html