首页 > 其他 > 详细

修改一个Label上字体的大小(富文本)

时间:2015-11-25 18:42:33      阅读:402      评论:0      收藏:0      [点我收藏+]

技术分享

假如修改上面的Label上价格30000的大小,那么需要用到富文本

上代码

// 字符串30000

 NSString * priceNumber = @"30000";

[priceNumber length];

    NSLog(@"%lu",(unsigned long)[priceNumber length]);

    _price = [[UILabel alloc] initWithFrame:CGRectMake(0,100,200,100)];

    NSMutableAttributedString *attriString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"¥%@/人",priceNumber]];

    [attriString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:25] range:NSMakeRange(1, [priceNumber length])];

    _price.attributedText = attriString;

    [self.view addSubview:_price];

 

修改一个Label上字体的大小(富文本)

原文:http://www.cnblogs.com/SensenCoder/p/4995475.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!