1、给label text 上色:

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

2、

textField.placeholder = @"username is in here!";
[textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];
[textField setValue:[UIFont boldSystemFontOfSize:] forKeyPath:@"_placeholderLabel.font"]; // 转自 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. 如何在VC中查询中文,及QT5的中文处理

    1,VC中查询所有含中文字符串 使用正则表达式,查询内容为: (".*[\u4E00-\u9FA5]+)|([\u4E00-\u9FA5]+.*") 这样,就可以把代码中的中文都查 ...

  2. Codeforces Gym 100610 Problem K. Kitchen Robot 状压DP

    Problem K. Kitchen Robot Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10061 ...

  3. insertion sort

    1.insertion sort #include <stdio.h> #include <time.h> #include <stdlib.h> #define ...

  4. 使用Java高速实现进度条

    基于有人问到如何做进度条,以下给个简单的做法: 主要是使用JProgressBar(Swing内置javax.swing.JProgressBar)和SwingWorker(Swing内置javax. ...

  5. ios--uitextfield动态限制输入的字数(解决方式)

    1.定义一个事件: -(IBAction)limitLength:(UITextField *)sender { bool isChinese;//推断当前输入法是否是中文 if ([[[UIText ...

  6. online ddl 跟踪

    | >mysql_prepare_alter_table T@4 : | | | | | | <mysql_prepare_alter_table 7368 T@4 : | | | | | ...

  7. Python学习 之 编程

    1.搭建python环境 交互模式:输入python进入交互模式,exit()退出交互模式 文本模式:新建*.py文件,编辑*.py文件,运行python *.py 2.python文件类型 (1)源 ...

  8. Qt 显示透明flash和编写QtWebkit插件

    Qt 有两种方法可以显示flash. 1. 通过QAxWidget 调用com形式显示flash, 需要本机安装IE flash插件 2. 直接通过qwebview显示flash, 需要下载webki ...

  9. angular 项目回顾

    从学习angular,到实际项目开发不到一周,完全是边写边学呀,都是为了项目,已使用angular 开发了两个项目了,有些技术当时只是会用,都没好好回顾一下,现在有时间回顾一下,项目中用到的一些指令, ...

  10. python(6)-logging 日志模块

    logging的日志分为5个级别分别为debug(), info(), warning(), error(), critical() 先来看一下简单的代码: logging.basicConfig(f ...