IOS中button的标题添加下划线
这个需求不是很常用 但是偶尔还是需要用到
NSMutableAttributedString *forgetpStr = [[NSMutableAttributedString alloc] initWithString:@"编辑"];
NSRange strRange2 = {0,[forgetpStr length]};
[forgetpStr addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:strRange2];
UIButton *bianJiButton = [[UIButton alloc] initWithFrame:CGRectMake((kScreenWidth-30)/2-40, (kScreenWidth-30)/2*heightScal, 30, 30*heightScal)];
[bianJiButton setAttributedTitle:forgetpStr forState:UIControlStateNormal];
[bianJiButton addTarget:self action:@selector(bianJiButtonAction:) forControlEvents:UIControlEventTouchUpInside];
bianJiButton.titleLabel.font = [UIFont systemFontOfSize:12];
bianJiButton.titleLabel.textColor = MyHexColor(@"999999");
bianJiButton.tag = indexPath.item;
bianJiButton.backgroundColor = [UIColor greenColor];
[cell.contentView addSubview:bianJiButton];