NSMutableAttributedString 使用
来源:互联网 发布:师洋淘宝店骂人视频 编辑:程序博客网 时间:2024/04/26 13:51
NSMutableAttributedString *mut = [[NSMutableAttributedStringalloc] initWithAttributedString:attributedString];
[mut addAttribute:(NSString *)kCTFontAttributeName
value:(__bridgeid)CTFontCreateWithName((__bridgeCFStringRef)[UIFontboldSystemFontOfSize:14].fontName,18,NULL)range:NSMakeRange(0, attributedString.length)];
//设置文本字间距
long number = 12;
CFNumberRef num =CFNumberCreate(kCFAllocatorDefault,kCFNumberSInt8Type,&number);
[mutaddAttribute:NSKernAttributeNamevalue:(__bridgeid)(num) range:NSMakeRange(0,[attributedStringlength])];
CFRelease(num);
//设置文本对齐方式
CTTextAlignment alignment =kCTLeftTextAlignment;
CTParagraphStyleSetting alignmentStyle;
alignmentStyle.spec =kCTParagraphStyleSpecifierAlignment;
alignmentStyle.valueSize =sizeof(alignment);
alignmentStyle.value = &alignment;
//设置文本行间距
CGFloat lineSpace = 44;
CTParagraphStyleSetting lineSpaceStyle;
lineSpaceStyle.spec =kCTParagraphStyleSpecifierMinimumLineHeight;
lineSpaceStyle.valueSize =sizeof(lineSpace);
lineSpaceStyle.value =&lineSpace;
//设置文本段间距
CGFloat paragraphSpacing = 4.0;
CTParagraphStyleSetting paragraphSpaceStyle;
paragraphSpaceStyle.spec =kCTParagraphStyleSpecifierParagraphSpacing;
paragraphSpaceStyle.valueSize =sizeof(CGFloat);
paragraphSpaceStyle.value = ¶graphSpacing;
CTParagraphStyleSetting settings[] ={alignmentStyle,lineSpaceStyle,paragraphSpaceStyle};
CTParagraphStyleRef style =CTParagraphStyleCreate(settings ,sizeof(settings)/sizeof(CTParagraphStyleSetting));
[mutaddAttribute:NSParagraphStyleAttributeNamevalue:(__bridgeid)(style) range:NSMakeRange(0,[attributedStringlength])];
- NSMutableAttributedString 使用
- NSMutableAttributedString使用
- NSMutableAttributedString使用
- NSMutableAttributedString使用
- NSMutableAttributedString的使用
- NSMutableAttributedString 的使用
- NSMutableAttributedString简单使用
- NSMutableAttributedString使用介绍
- iOS NSMutableAttributedString 使用详解
- NSMutableAttributedString使用介绍
- 【swift】NSMutableAttributedString的使用
- iOS NSMutableAttributedString 使用详解
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- 监督学习与非监督学习
- 字符转换库的网址
- pouchDB CouchDB 例子 及cors处理
- java日期格式转换工具类
- SQL 常用函数
- NSMutableAttributedString 使用
- [iPhone中级] iPhone团购信息客户端的开发 (一)
- hdu 1175 连连看
- Using HttpClient properly to avoid CLOSE_WAIT TCP connections
- 完全卸载oracle11g步骤
- [iPhone中级]iPhone团购信息客户端的开发 (二)
- No Java virtual machine was found....eclipse/jre/bin/java
- dos 安装android apk 以及导出系统文件(手机需root)到本地磁盘
- TIME_WAIT状态的意义