UILabel 行间距
2015-06-02 18:31
465 查看
UILabel * headLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 15, ZRFullScreenWidth - 30, 40)];
headLabel.backgroundColor = [UIColor clearColor];
headLabel.textColor = HEXRGBCOLOR(0xB7B7B7);
headLabel.text = @"为了更好地为您提供挂号服务,请填写真实的就诊人信息,以及手机号用于发送预约码";
[headLabel setNumberOfLines:0];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = 10;// 字体的行间距
NSDictionary *newAttribute = @{
NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:14.0f],
NSParagraphStyleAttributeName:paragraphStyle
};
NSAttributedString *newAttributeStr = [[NSAttributedString alloc]initWithString:headLabel.text attributes:newAttribute];
[headLabel setAttributedText:newAttributeStr];
[headLabel sizeToFit];
headLabel.backgroundColor = [UIColor clearColor];
headLabel.textColor = HEXRGBCOLOR(0xB7B7B7);
headLabel.text = @"为了更好地为您提供挂号服务,请填写真实的就诊人信息,以及手机号用于发送预约码";
[headLabel setNumberOfLines:0];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = 10;// 字体的行间距
NSDictionary *newAttribute = @{
NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:14.0f],
NSParagraphStyleAttributeName:paragraphStyle
};
NSAttributedString *newAttributeStr = [[NSAttributedString alloc]initWithString:headLabel.text attributes:newAttribute];
[headLabel setAttributedText:newAttributeStr];
[headLabel sizeToFit];
相关文章推荐
- UIImage在拍照上传到服务器时,图片发生旋转解决方案
- xcode 中 UILable 使用方法简介
- quintic蓝牙芯片广播中添加MAC地址的方法
- 程序员的量化交易之路(12)--Guice库的学习
- requestWindowFeature(); 的应用
- Android Volley完全解析(三),定制自己的Request
- iOS学习(3)——UIImageView
- Solr之functionQuery(函数查询)
- 长时间停留在calculating requirements and dependencies 的解决方案
- [SSMS][Visual Studio] 解決 - Unable to find the requested .Net Framework Data Provider. It may not be installed
- 如何让程序员更容易的开发Web界面?重构SmartAdmin展示TinyUI
- FFmpeg building for iOS 8.3
- KQUEUE FreeBSD
- Duilib bkimage 属性
- 再探java基础——break和continue的用法
- JAVA UUID 生成
- Perfect Sequence
- 关于MVC不能用EasyUI的问题
- UiAutomator for android 巧换角度
- qemu-guest-agent调研