NSMutableAttributedString 的使用
NSMutableAttributedString *msAttriStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"this is book ",departmentStr,departmentStatistics.d_count]];
//设置字体大小
[msAttriStr addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18.0f]} range:NSMakeRange(0,length];
//设置字体颜色
[msAttriStr addAttributes:@{NSForegroundColorAttributeName:[UIColor redColor]} range:NSMakeRange(0, length)];
NSMutableAttributedString 的使用的更多相关文章
- iOS - NSMutableAttributedString富文本的实现
NSMutableAttributedString继承于NSAttributedString(带属性的字符串)能够简单快速实现富文本的效果;不多说直接上效果图和代码,通俗易懂: (一)效果图: (二) ...
- iOS中富文本NSMutableAttributedString的用法
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:@"我是富文 ...
- NSMutableAttributedString(转)
NSMutableAttributedString计算高度的问题 _label_page2_1 = [[UILabel alloc] init]; _label_page2_1.numberOfLin ...
- NSMutableAttributedString常用代码
NSTextAttachment *attachment = [[NSTextAttachment alloc] init]; attachment.image = [UIImage imageNam ...
- NSMutableAttributedString的使用
1.设置字符串中数字字符串的颜色: // 设置字符串中数字的颜色 - (void)setTextColor:(UILabel *)label FontNumber:(id)font AndRange: ...
- objective-c NSMutableAttributedString
NSMutableAttributedString 是一个很强悍的富文本处理字符串,可以方便的实现一个字符串中某个字符的样式处理.我把我下面代码实现的功能步骤说一下:首先拼接两个字符串,然后给前前半部 ...
- iOS 学习 - 12.NSMutableAttributedString 计算高度
计算 NSMutableAttributedString 高度,必须要有两个属性 -(void)test{ UILabel *label = [[UILabel alloc]initWithFrame ...
- 新浪微博客户端(35)-使用NSMutableAttributedString实现多行文本的效果
DJComposeViewController.m import "DJComposeViewController.h" #import "DJAccountTool.h ...
- NSMutableAttributedString可变属性字符串的用法
适用于:当你想对一个字符串中的某几个字符更改颜色,字体... NSString *string = @"今日营养配餐提供热量1800千卡,需要饮食之外额外补充钙10mg,铁20mg,锌9.5 ...
随机推荐
- coderforces 731c
题目大意:给出m组数据,每组数据包括两个数Li与Ri,分别表示左右袜子的索引(下标),表示这一天要穿的袜子:而我们要使得每天穿的这两只袜子的颜色相同,所以可以改变袜子的颜色,每次只能改变一只袜子的颜色 ...
- [AIR] 新建窗口的方法
有时根据需要,我们需要在AIR程序中开多个窗口window 以下新建一个窗口: var opion:NativeWindowInitOptions = new NativeWindowInitOpti ...
- Angular进度-1207
https://www.angular.cn/docs/ts/latest/tutorial/toh-pt1.html
- [源码]String StringBuffer StringBudlider(1String部分)
String /** The value is used for character storage. */ private final char value[]; /** Th ...
- jenkins中submodule的使用
尝试过各种插件配置都不行. 最后只好通过命令来更新Submodule了. 首先把Git更新到最新,为什么要更新等会儿再说. 项目里的Submodule要配置好,这是基本的. (检查是否配置好的方法: ...
- 现代工程仿真CAE技术介绍
随着现代科学技术的发展,人们正在不断建造更为快速的交通工具.更大规模的建筑物.更大跨度的桥梁.更大功率的发电机组和更为精密的机械设备.这一切都要求工程师在设计阶段就能精确地预测出产品和工程的技术性能, ...
- U盘快捷方式中毒处理办法
这是网上某位大神的,对于我这个U盘总中毒的人真的很好用,太开心啦啦 http://blog.csdn.net/jzwong/article/details/51002568
- android studio 生成aar包并在其他工程引用 (导入)aar包
1.aar包是Android studio下打包android工程中src.res.lib后生成的aar文件,aar包导入其他android studio 工程后,其他工程可以方便引用源码和资源文件 ...
- jquery 面板拖拽
在网上找了好多的例子 都不满足我所需要 在网上找了一篇关于easyui是一个拓展的demo 然后根据demo 把我所需要的东西进行再次拓展 满足我的需求 也不多说了 上代码 首先 你肯定是要导eas ...
- JS-安全检测JavaScript基本数据类型和内置对象的方法
前言:在前端开发中经常会需要用到检测变量数据类型的需求,比如:判断一个变量是否为undefined或者null来进行下一步的操作,今天在阅读“编写高质量代码-改善JavaScript程序的188个建议 ...