美文网首页
button 按钮 字符间距

button 按钮 字符间距

作者: 阳光下的灰尘 | 来源:发表于2023-07-25 17:30 被阅读0次

NSString *buttonTitle = title;
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:buttonTitle];

// 设置字符间距(这里使用10作为例子)
[attributedString addAttribute:NSKernAttributeName value:@(2) range:NSMakeRange(0, [buttonTitle length])];

UIFont *boldFont = WLFontBold(14); // 设置所需的粗体大小
[attributedString addAttribute:NSFontAttributeName value:boldFont range:NSMakeRange(0, [buttonTitle length])];

// 将修改后的标题应用到按钮上
[_updataCardBtn setAttributedTitle:attributedString forState:UIControlStateNormal];

相关文章

网友评论

      本文标题:button 按钮 字符间距

      本文链接:https://www.haomeiwen.com/subject/hdehpdtx.html