button 按钮 字符间距

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];
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容