您的位置:首页 > 产品设计 > UI/UE

iOS UILabel一行字设置不同的字体

2015-09-29 16:50 585 查看
 NSString *babyName = @"测试";
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"111111111%@222",babyName]];
[str addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:17] range:NSMakeRange(9, babyName.length)];
self.lbTips.attributedText = str ;


这样 就可以设置一个label的不同区间的不同字体了

那 str 可以添加多个属性
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: