// 设置按钮的文字
showTextButton.titleLabel.numberOfLines = 0;
[showTextButton setTitle:self.message.text forState:UIControlStateNormal];
// 强制更新
[showTextButton layoutIfNeeded];
// 设置按钮的高度就是titleLabel的高度
[showTextButton updateConstraints:^(MASConstraintMaker *make) {
CGFloat buttonH = showTextButton.titleLabel.frame.size.height;
make.height.equalTo(buttonH);
}];
// 强制更新
[showTextButton layoutIfNeeded];
按钮的基本属性
[btnChooseBank setTitleEdgeInsets:UIEdgeInsetsMake(0, 7, 0, 0)];//距离左边7个距离
btnChooseBank.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;//文字靠右