//让UIButton的title居右对齐
allButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
//此时文字会紧贴到做边框,我们可以设置
allButton.contentEdgeInsets = UIEdgeInsetsMake(0,0, 0, 10);
本文介绍如何在iOS开发中调整UIButton的文字对齐方式为居右,并通过设置按钮的内容边缘内距解决文字紧贴边框的问题。
//让UIButton的title居右对齐
allButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
//此时文字会紧贴到做边框,我们可以设置
allButton.contentEdgeInsets = UIEdgeInsetsMake(0,0, 0, 10);
4431

被折叠的 条评论
为什么被折叠?