013-一些开发小技巧

时间:2014-10-17 13:44:24   收藏:0   阅读:196

1.动态调整文字大小

NSString *dPriceString  = [NSString stringWithFormat:@"¥%d",model.price]

NSMutableAttributedString *dPrice = [[NSMutableAttributedString alloc] initWithString: dPriceString];
[dPrice addAttribute: NSFontAttributeName value: [UIFont systemFontOfSize: 12] range: NSMakeRange(0, 1)];
[dPrice addAttribute: NSFontAttributeName value: [UIFont systemFontOfSize: 18] range: NSMakeRange(1, dPriceString.length - 1)];
self.labDiscount.attributedText = dPrice;

 

原文:http://www.cnblogs.com/lszwhb/p/4030845.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!