调用

[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. SPSS-因子分析

    因子分析 有可能用较少的综合指标分析存在于各变量中的各类信息,而各综合指标之间彼此是不相关的,代表各类信息的综合指标称为因子.定义:因子分析就是用少数几个因子来描述许多指标或因素之间的联系,以较少几个 ...

  2. js 统计数组中元素的个数

    var all = "02 06 11 12 19 29 09 10 12 19 22 29 08 11 13 19 28 31 07 08 09 15 22 27 10 18 19 29 ...

  3. 04_web基础(九)考核与评估

  4. Linux切换工作目录命令:cd

    cd [语法]cd[目录路径][详解]cd指令用于在不同目录间进行切换,前提下该帐号要有这个目录的权限.如果直接输入cd,并省略目录名,则会自动切换到用户根目录下.[参数] 选项 相应功能 目录路径 ...

  5. create-react-app之Invalid Host Header

    [create-react-app之Invalid Host Header] 1.When you enable the `proxy` option, you opt into a more str ...

  6. 下载excel

    使用struts2的方式完成下载 对于下载excel2003,contentType如此设置 <result name="success" type="stream ...

  7. day32 并发编程

    并发编程 并发编程的理论 python中实现多进程 进程测试 import os import time while True: time.sleep(0.5) print("hahaha& ...

  8. jenkins动态参数插件Dynamic Parameter安装及简单使用

    插件安装: 1.先下载插件hpi文件到本地   jenkins插件下载地址 http://mirror.xmission.com/jenkins/plugins/ http://updates.jen ...

  9. 第一次登录mysql,使用任何命令都报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

    问题: 使用临时密码登录成功后,使用任何myql命令,例如show databases;都提示下面的报错 ERROR 1820 (HY000): You must reset your passwor ...

  10. Pandas之数据结构

    pandas入门 由于最近公司要求做数据分析,pandas每天必用,只能先跳过numpy的学习,先学习大Pandas库 Pandas是基于Numpy构建的,让以Numpy为中心的应用变得更加简单 pa ...