赞
踩
比如文本展示为姓名和性别,但是我们不能排除姓名会很长,所以此刻的lable宽度我们就不能写死,换句话说lable的宽度根据文本的内容来定
我经常用两种方式解决:
1.前面文章已经涉及:lable自适应http://blog.csdn.net/tuwanli125/article/details/51003798
2.就是使用NSMutableAttributedString属性给infoL设置文本
NSString *infoStr = [NSStringstringWithFormat:@"%@ %@",name,sex];
NSMutableAttributedString *infoAttStr = [[NSMutableAttributedStringalloc] initWithString:infoStr];
NSArray *colorArr =@[[UIColorcolorWithRed:0/255.0green:168/255.0blue:255
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。