设置UIButton上字体的对齐方式,不是用:
[Button.titleLabel setTextAlignment:UITextAlignmentCenter];
而是用:
[Button setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter];
typedef
NS_ENUM(NSInteger, UIControlContentHorizontalAlignment) {
UIControlContentHorizontalAlignmentCenter = 0,
UIControlContentHorizontalAlignmentLeft = 1,
UIControlContentHorizontalAlignmentRight = 2,
UIControlContentHorizontalAlignmentFill = 3,
};