设置UIButton上字体的对齐方式,不是用:
[Button.titleLabel setTextAlignment:UITextAlignmentCenter];
而是用:
[Button setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter];
typedef
NS_ENUM(NSInteger, UIControlContentHorizontalAlignment) {
UIControlContentHorizontalAlignmentCenter = 0,
UIControlContentHorizontalAlignmentLeft = 1,
UIControlContentHorizontalAlignmentRight = 2,
UIControlContentHorizontalAlignmentFill = 3,
};
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-08 22:18:49