作者:jysghyb | 来源:互联网 | 2023-07-15 14:11
UIEdgeInsets 设置边距UIEdgeInsetsUIEdgeInsetsMake( CGFloattop, CGFloatleft, CGFlo
UIEdgeInsets 设置边距
UIEdgeInsets UIEdgeInsetsMake (
CGFloat top,
CGFloat left,
CGFloat bottom,
CGFloat right
);
按钮button中自带有一个label,通过设置label的边距可以自定义label在按钮中的位置:
[button setTitleEdgeInsets:UIEdgeInsetsMake(0,0,0,0)];
设置按钮自带的label显示在按钮的右方(右对齐)
[button setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];