1、给label text 上色:

  1. NSInteger stringLength = ;
  2. stringLength = model.ToUserNickName.length;
  3. NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:string];
  4. NSLog(@"textLength is %u", model.ToUserNickName.length);
  5. [str addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(,stringLength)];
  6. self.CommentContent.attributedText = str; // self.CommentContent.attributedText 是一个 label

2、

  1. textField.placeholder = @"username is in here!";
  2. [textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];
  3. [textField setValue:[UIFont boldSystemFontOfSize:] forKeyPath:@"_placeholderLabel.font"];
  4.  
  5. // 转自 http://blog.csdn.net/woaifen3344/article/details/38352015

给label text 上色 && 给textfiled placeholder 上色的更多相关文章

  1. [D3] Add label text

    If we want to add text to a node or a image // Create container for the images const svgNodes = svg ...

  2. Printing multipage output

    Printing known-length multipage output Using the PrintDataGrid control for multipage grids Example: ...

  3. Cross-Browser HTML5 Placeholder Text

    One of the nice enhancement in HTML5 web form is being able to add placeholder text to input fields. ...

  4. 为label或者textView添加placeHolder

    Tip:使用textView的代理需要在头文件中加入: <UITextViewDelegate> h文件 @interface FeedbackViewController : UIVie ...

  5. CF 149D Coloring Brackets(区间DP,好题,给配对的括号上色,求上色方案数,限制条件多,dp四维)

    1.http://codeforces.com/problemset/problem/149/D 2.题目大意 给一个给定括号序列,给该括号上色,上色有三个要求 1.只有三种上色方案,不上色,上红色, ...

  6. 让Placeholder在IE中燥起来

    网上有好多关于这方面解决兼容性问题的文章,很多招式,学会这一招,让你轻松搞定Placeholder的兼容性,叫我好人,拿走,不谢.... placeholder属性是HTML5 中为input添加的. ...

  7. UITextView添加一个placeholder功能

    控件UITextField有个placeholder属性,UITextField和UITextView使用方法基本类似,有两个小区别:1.UITextField单行输入,而UITextView可以多行 ...

  8. input 的 placeholder属性在IE8下的兼容处理

    placeholder是input标签的新属性,在使用的时候有两个问题: 1.IE8 下不兼容 处理思路: 如果浏览器不识别placeholder属性,给input添加类名placeholder,模仿 ...

  9. 兼容的placeholder属性

    作为一个.net后台开发的程序猿,博客里既然大多都是前端相关的博文.是不是该考虑换方向了,转前端开发得了 ... 小小吐槽一下,近期受该不该跳槽所困惑,我有选择困难症! 继续前端,这次说一下输入框 p ...

随机推荐

  1. cocos2d-x 读取.plist文件

    转自:http://blog.csdn.net/hgplan/article/details/8629904 在cocos2d-x中可以用.plist格式的文件来保存数据,它是XML文件格式的一种,在 ...

  2. IIS应用程序池性能分析

    #查看应用程序池和w3wp.exe进程的对应关系iisapp -a C:\windows\system32\inetsrv\appcmd.exe list wp 查看任务管理器: 在性能计数器中找到对 ...

  3. IOS Note - View Controller(视图控制器)

    Application Delegate(应用程序委托) Application Name: SingleView SingleViewAppDelegate.h #import <UIKit/ ...

  4. [RxJS] Introduction to RxJS Marble Testing

    Marble testing is an expressive way to test observables by utilizing marble diagrams. This lesson wi ...

  5. mysql索引需要了解的几个注意

    板子之前做过2年web开发培训(入门?),获得挺多学生好评,这是蛮有成就感的一件事,准备花点时间根据当时的一些备课内容整理出一系列文章出来,希望能给更多人带来帮助,这是系列文章的第一篇 注:科普文章一 ...

  6. 实例源码--Android手机狗(防盗)源码

      下载源码   技术要点: 1. SharedPreferences数据保存 2. SIM卡状态监 听 3. 发短信.发邮 箱.获取通讯信息 4. 源码带详细的 中文注释 ...... 详细介绍: ...

  7. TortoiseGit安装教程

    TortoiseGit 是Windows下的可视化Git界面. 下载Git 网站地址: http://code.google.com/p/tortoisegit/ 安装前必须装上msysgit才能在W ...

  8. 详解MYSQL数据库密码的加密方式及破解方法

    MYSQL加密方式:http://blog.csdn.net/listeningsea/article/details/8139641

  9. SQlServer2008 之 定时执行sql语句作业的制定

    1.打开[SQL Server Management Studio],在[对象资源管理器]列表中选择[SQL Server 代理]: 2.鼠标右击[SQL Server 代理],选择[启动(S)],如 ...

  10. Peter's Hobby

    Problem Description Recently, Peter likes to measure the humidity of leaves. He recorded a leaf humi ...