button的相关属性

设置自定义按钮的文字大小

[submit.titleLabel setFont:[UIFont boldSystemFontOfSize:16]];

设置按钮选中状态的颜色

[btn setTintColor:[UIColor clearColor]];

设置按钮文字内容的水平对齐方式

btn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft

设置按钮文字的缩放

[self.rightBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 45, 0,0)]

NSDictionary *attDic = @{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:13]};

    NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithString:@"限:每笔限额50,000,00万,每日限额50,000,00万,最多支付5次"];

    [attribute addAttributes:attDic range:NSMakeRange(0, 2)];

    self.limitLabel.textColor = [UIColor grayColor];

    self.limitLabel.font = [UIFont systemFontOfSize:13];

    self.limitLabel.attributedText = attribute;

原文地址:https://www.cnblogs.com/zhaozhongpeng/p/4867712.html