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

posted on 2019-03-21 10:44  懂事长qingzZ  阅读(247)  评论(0编辑  收藏  举报