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

假如修改上面的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];

 

posted @ 2015-11-25 17:59  SensenCoder  阅读(762)  评论(0编辑  收藏  举报