NSString *string = @"注册过程中出现问题,致电400-650-5167联系会养车工作人员";
    NSRange range = [string rangeOfString: @"400-650-5167"];
    NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithString: string];
    [attribute addAttributes: @{NSForegroundColorAttributeName: [UIColor colorWithRed:84.0f/255.0f green:116.0f/255.0f blue:173.0f/255.0f alpha:1.0f]} range: range];
UILabel *label = [[UILabel alloc] initWithFrame: CGRectMake(0, 200, 320.0, 100.0)];
    [label setText: string];
    label.textColor = [UIColor colorWithRed:102.0f/255.0f green:102.0f/255.0f blue:102.0f/255.0f alpha:1.0f];
    label.font = [UIFont boldSystemFontOfSize:14];
    label.numberOfLines = 0;
    [label setAttributedText: attribute];
    [self.view addSubview:label];

UIlabel设置不同的颜色的更多相关文章

  1. 设置placeholder字体颜色

    /*设置placeholder字体颜色*/::-webkit-input-placeholder{ color: #FFF;}:-ms-input-placeholder{ color: #FFF;} ...

  2. Android中设置TextView的颜色setTextColor

    tv.setTextColor(Color.parseColor("#FFFFFF")); tv.setTextColor(Color.WHITE); tv.setTextColo ...

  3. JavaGUI——设置框架背景颜色和按钮颜色

    import java.awt.Color; import javax.swing.*; public class MyDraw { public static void main(String[] ...

  4. UITabBar 设置字体的颜色(选中状态/正常状态)setTitleTextAttributes

    UITabbar有个setTintColor这个方法,可以理解为,高亮的时候,或者点击后的颜色设置. UITabBarItem有个setTitleTextAttributes的方法,是用来设置字体的颜 ...

  5. vc设置按钮文字颜色

    设置按钮文字颜色使用 CMFCBUTTON即可 在OnInitDialog函数加入如下内容即可 ((CMFCButton*)GetDlgItem(IDC_MFCBUTTON1))->SetTex ...

  6. UILabel设置行间距和字间距并计算高度-b

    #define UILABEL_LINE_SPACE 6 #define HEIGHT [ [ UIScreen mainScreen ] bounds ].size.height //给UILabe ...

  7. 【转】Android中设置TextView的颜色setTextColor--代码中设置字体颜色

    原文网址:http://www.cnblogs.com/myphoebe/archive/2012/01/06/2314728.html android中设置TextView的颜色有方法setText ...

  8. Qt中设置widget背景颜色/图片的注意事项(使用样式表 setStyleSheet())

    在Qt中设置widget背景颜色或者图片方法很多种:重写paintEvent() , 调色板QPalette , 样式表setStyleSheet等等. 但是各种方法都有其注意事项,如果不注意则很容易 ...

  9. div 背景色设置_DIV背景颜色设置

    DIV 背景色设置篇-div背景颜色设置篇 一.div标签内直接设置背景颜色   -   TOP <div style="background:#000; color:#FFF&quo ...

随机推荐

  1. ASP.NET Core身份识别

    Introduction to Identity 66 of 93 people found this helpful By Pranav Rastogi, Rick Anderson, Tom Dy ...

  2. ajax 动态获取json的例子

    1.前台脚本: //用于切换图片列表的ajax function changePhoto(title,hotelId){ $.ajax({ contentType: "application ...

  3. 在AngularJS应用中实现认证授权

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAokAAAFwCAIAAABbwHY6AAAgAElEQVR4nOy9+XtcxbX3+/4H9z73jP ...

  4. bootstrap的弹出框

    data-toggle="popover";//以弹出框事件触发 data-content="弹出框中内容"; data-placement="弹出框 ...

  5. 《基于MVC的Javascript》

    var Class = function(){ var klass = function(){ this.init.apply(this,arguments); } klass.prototype.i ...

  6. ubuntu14 eclipse luna 无法显示菜单 , 解决方案

    使用命令行 , 输入 Exec=env UBUNTU_MENUPROXY=0 <eclipse的安装路径>/eclipse 就可以了 或者建立一个Eclipse的快捷方式,eclipse. ...

  7. NOR FLASH与NAND FLASH的区别

    NOR和NAND是现在市场上两种主要的非易失闪存技术.Intel于1988年首先开发出NOR flash技术,彻底改变了原先由EPROM和EEPROM一统天下的局面.紧接着,1989年,东芝公司发表了 ...

  8. Android实现Activity页面跳转切换动画特效

    了解Android程序设计的人应该知道,在Android 2.0之后有了overridePendingTransition(),其中里面两个参数,一个是前一个activity的退出,另一个activi ...

  9. input覆盖select实现select可写可选择

    1.有时需要一个select选择框,但是对select选择框希望是既可以选择也可以进行输入.下边的代码就是在select选择框上放了一个input框,覆盖在select上面.实现伪装的select效果 ...

  10. struts2配置通用action一个顶N个,你还在写一大堆action吗?

    <!-- 通用action!!!约定优于配置 --> <action name="*_*" class="cn.cnsdhzzl.action.{1}A ...