给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 ...
随机推荐
- php and web service with wsdl
Following are the links: Developing Web Services Using PHP PHP Web Services with WSDL Creating Web S ...
- DNS添加/修改/查询/删除A记录
#查询DNS可用类 Get-WmiObject -Namespace root\MicrosoftDNS -List #查询所有资源记录 $mydns = [WMIClass]"ROOT\M ...
- Exchange模式功能
Exchange模式: Outlook中的投票功能: 新建邮件--选项--使用投票按钮
- 目录启动CXF启动报告LinkageError异常以及Java的endorsed机制
本文纯属个人见解,是对前面学习的总结,如有描述不正确的地方还请高手指正~ Exception in thread "main" java.lang.LinkageError: JA ...
- C#操作MySQL数据库-----HelloWorld
这里采用在visual studio 2010中通过MySql.Data.dll.MySql.Web.dll来连接mysql数据库, 之后便进行数据的插入和查询. Program.cs文件内容如下: ...
- cocos2dx3.2 画图方法小修改之 C++ final学习
今天用cocos2dx 3.2版本号学习画图功能, 于是我重载Node 的draw方法.发现报错, watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQ ...
- Chronometer控件实现的Android计时器
本文为大家演示了如何使用Chronometer控件实现Android计时器的实例. 先贴上最终的实现效果图: Android计时器实现思路 使用Chronometer控件实现计器的操作.通过设置set ...
- Exploring Python Code Objects
Exploring Python Code Objects https://late.am/post/2012/03/26/exploring-python-code-objects.html Ins ...
- apue.h
[root@localhost unix_env_advance_prog]# cat apue.h #ifndef _APUE_H #define _APUE_H #define _XOPEN_SO ...
- memcahced 更新
memcahc特性: 在 Memcached中可以保存的item数据量是没有限制的,只要内存足够 . Memcached单进程在32位系统中最大使用内存为2G,若在64位系统则没有限制,这是由于32位 ...