给label text 上色 && 给textfiled placeholder 上色
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 上色的更多相关文章
- [D3] Add label text
If we want to add text to a node or a image // Create container for the images const svgNodes = svg ...
- Printing multipage output
Printing known-length multipage output Using the PrintDataGrid control for multipage grids Example: ...
- Cross-Browser HTML5 Placeholder Text
One of the nice enhancement in HTML5 web form is being able to add placeholder text to input fields. ...
- 为label或者textView添加placeHolder
Tip:使用textView的代理需要在头文件中加入: <UITextViewDelegate> h文件 @interface FeedbackViewController : UIVie ...
- CF 149D Coloring Brackets(区间DP,好题,给配对的括号上色,求上色方案数,限制条件多,dp四维)
1.http://codeforces.com/problemset/problem/149/D 2.题目大意 给一个给定括号序列,给该括号上色,上色有三个要求 1.只有三种上色方案,不上色,上红色, ...
- 让Placeholder在IE中燥起来
网上有好多关于这方面解决兼容性问题的文章,很多招式,学会这一招,让你轻松搞定Placeholder的兼容性,叫我好人,拿走,不谢.... placeholder属性是HTML5 中为input添加的. ...
- UITextView添加一个placeholder功能
控件UITextField有个placeholder属性,UITextField和UITextView使用方法基本类似,有两个小区别:1.UITextField单行输入,而UITextView可以多行 ...
- input 的 placeholder属性在IE8下的兼容处理
placeholder是input标签的新属性,在使用的时候有两个问题: 1.IE8 下不兼容 处理思路: 如果浏览器不识别placeholder属性,给input添加类名placeholder,模仿 ...
- 兼容的placeholder属性
作为一个.net后台开发的程序猿,博客里既然大多都是前端相关的博文.是不是该考虑换方向了,转前端开发得了 ... 小小吐槽一下,近期受该不该跳槽所困惑,我有选择困难症! 继续前端,这次说一下输入框 p ...
随机推荐
- Nginx学习之十一-Nginx启动框架处理流程
Nginx启动过程流程图 下面首先给出Nginx启动过程的流程图: ngx_cycle_t结构体 Nginx的启动初始化在src/core/nginx.c的main函数中完成,当然main函数是整个N ...
- 【转】WPF颜色相关操作
using System.Windows.Media; 1.String转换成Color Color color = (Color)ColorConverter.ConvertFromStri ...
- javascript 笔记(待续)
1.基础对象 var o=new Object(); o.xxx=1; o.xx=2; var 01={xxx=1,xx=2} 2.==与=== "5"==5 Tru ...
- BZOJ 3505: [Cqoi2014]数三角形 数学
3505: [Cqoi2014]数三角形 Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/pr ...
- C#窗体间通讯的几种处理方法
应用程序开发中,经常需要多窗体之间进行数据通信,写几个例子,把几种常用的通信方式总结一下: 主窗体Form1是一个ListBox,单击选中某列时,弹出窗体Form2,Form2中两个控件,一个是Tex ...
- 随意一条查询sql转换为查询结果集相应的数目
原思路: 像括号配对一样,假设遇见select 就入栈,假设遇见from就出栈,直到栈为空,取得此时的位置.进行字符串截取. 实现方法:遇见字符s而且连续后5个字符elect 就+1,遇见字符f而且连 ...
- 解决PowerDesigner 反向工程没有注释(备注)
本文转载自:http://www.cnblogs.com/zhangxb/archive/2012/04/20/2458898.html 1. 列注释 原来代码: {OWNER, TABLE, S, ...
- Sublime Text 3 常用快捷键总结
1.快速跳转到某一行:Ctrl+G,输入行号,可以快速跳转到该行 2.快速查找:Ctrl+P 输入"@函数名"可以快速查找到函数 输入"#+文本" 3.多行游标 ...
- 小白日记25:kali渗透测试之提权(五)--利用配置不当提权
利用配置不当提权 与漏洞提权相比,更常见的方法.在大部分企业环境下,会有相应的补丁更新策略,因此难以通过相应漏洞进行入侵.当入侵一台服务器后,无法照当相应的补丁进行提权,可通过寻找是否存在配置不当进行 ...
- 炼数成金hadoop视频干货01
视频地址:http://pan.baidu.com/s/1dDEgKwD 最开始还是讲hadoop的起源,但是和其他垃圾视频不同,不是照本宣科,听了还是受益.作者给人一种感觉就是他是确实把他的经验和体 ...