同一labeltext设置不同的属性

来源:互联网 发布:nodejs res.json 编辑:程序博客网 时间:2024/05/18 03:41
        NSMutableAttributedString *attributeString =  [[NSMutableAttributedString alloc] initWithString:title];                [attributeString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15] range:NSMakeRange(0, 4)];        [attributeString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:13] range:NSMakeRange(4,[title length]- 4)];        [attributeString addAttribute:NSForegroundColorAttributeName value:[UIColor orangeColor] range:NSMakeRange(4,[title length]- 4)];        _naviLabel.attributedText = attributeString;

0 0
原创粉丝点击