调用

[self fuwenbenLabel:contentLabel FontNumber:[UIFont systemFontOfSize:] AndRange:NSMakeRange(, ) AndColor:RGBACOLOR(, , , )];

方法

 //设置不同字体颜色
-(void)fuwenbenLabel:(UILabel *)labell FontNumber:(id)font AndRange:(NSRange)range AndColor:(UIColor *)vaColor
{
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:labell.text]; //设置字号
[str addAttribute:NSFontAttributeName value:font range:range]; //设置文字颜色
[str addAttribute:NSForegroundColorAttributeName value:vaColor range:range]; labell.attributedText = str;
}

iOS一段文字设置多种颜色格式的更多相关文章

  1. android 一个TextView设置多种颜色

    时候一个文本框为了强调内容需要显示不同颜色,用以下代码可以轻松实现 方法一:(适用于颜色变化多的情况)   //为文本框设置多种颜色 textView=(TextView)findViewById(R ...

  2. poi HSSFRichTextString 对cell中的每一段文字设置字体

    HSSFRichTextString ts= new HSSFRichTextString(" 经审核,我司已同意其出库申请.请你部按规定将托管银行承兑汇票办理出库." + &qu ...

  3. 在一个Label上设置多种颜色字体

    #import "AppDelegate.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL ...

  4. iOS 将系统文字设置为中文

    在.info文件中添加  Localization native development region 键值 string   Value值:en

  5. iOS 设置Label中特定的文字大小和颜色

    直接上代码: _price = @"27"; NSMutableAttributedString *attributedString = [[NSMutableAttributed ...

  6. 设置一个label显示多种颜色,多种字体大小

    UILabel* label = [[UILabel alloc] init]; label.frame = CGRectMake(0, 100, 200, 100); label.textColor ...

  7. UITabBarController 、TabBar背景颜色设置,UITabBarItem的文字样式(颜色和大小)UITabBarItem的位置调整

    改变UITabBarController的颜色 UIView*mView=[[UIView alloc]initWithFrame:CGRectMake(0,0,320,48)];//这是部分tabb ...

  8. Echarts 设置地图上文字大小及颜色

    Echarts 设置地图上文字大小及颜色,效果如下: 上代码:关键代码用红色 series: [ { //name: '香港18区人口密度', type: 'map', mapType: 'jiang ...

  9. IOS 设置ios中DatePicker的日期为中文格式

    设置ios中DatePicker的日期为中文格式 1.在模拟器中的“设置”-“通用”-“多语言环境”-“语言”设置为“简体中文”, 2.“区域格式”设置为“中国”.

随机推荐

  1. js基础-基本包装类型

    var t = 13; t.toString(); //t是一个简单数值类型 现在有了方法 toString 对象类型的方法 //数值类型有对应的包装类型 var t1 =new Number(333 ...

  2. 三种方法让Response.Redirect在新窗口打开

    通过设置form的target属性同样可以让Response.Rederect所指向的url在新的窗口打开,下面为大家介绍三种具体的实现方法 Response.Rederect在默认情况下是在本页跳转 ...

  3. JAVA回文

    package huiwen; import java.util.Scanner; public class Huiwen { public static void main(String[] arg ...

  4. VFS: Cannot open root device "nfs" or unknown-block(0,255)错误的解决

    1. 解决办法:在内核配置时候文件系统中选中Root file system on NFS

  5. canvas刮奖

    (function (global, factory) { typeof module === 'object' && typeof module.exports === 'objec ...

  6. CentOS6.5安装MySQL5.7详细教程(本人6.3也行)

    本文参考http://www.cnblogs.com/lzj0218/p/5724446.html 主要参考博文: https://segmentfault.com/a/119000000304949 ...

  7. SAP 000 客户端初始登录

    Solution 在SAP系统DB中删除账号SAP*,SAP系统会自动创建SAP*这个账号,然后初始密码是“PASS”,这样就获得Client 000 SAP*账号. Step by Step 以Or ...

  8. 8. String to Integer (整数的溢出)

    Implement atoi to convert a string to an integer. If no valid conversion could be performed, a zero ...

  9. gridview空间使用

    1.HTML代码 <asp:GridView ID="gv_Info" runat="server" AutoGenerateColumns=" ...

  10. python指针

    class ListNode: def __init__(self, x): self.val = x self.next = None就两个属性 value 和 next,因为单节点默认next是没 ...