UIButton的title位置问题

UIButton的title位置问题

UIButton的title位置是默认居中的,有的时候,我们需要的是一个靠左或者靠右显示,那么这时候可以用到button的一个自带属性:

        button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;


通过设置这个属性,达到想要的位置。

另外也是可以通过titleInset 调整

posted @ 2015-06-04 15:20  沙影无痕  阅读(315)  评论(0编辑  收藏  举报