给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 ...
随机推荐
- C语言根据日期取其位于一年中的第几天
#include <iostream> #include <stdlib.h> using namespace std; bool isLeapYear( int iYear ...
- javax.naming.NameNotFoundException
2015-08-27 09:53:16,463 [localhost-startStop-1] DEBUG [org.springframework.jndi.JndiTemplate] - Look ...
- 2015南阳CCPC G - Ancient Go 暴力
G - Ancient Go Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Yu Zhou likes to play Go wi ...
- key 限制字符的输入
//限制字符的输入 { 只能输入以下字符 } procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);begin If (Key ...
- 内核映像的形成 —— KBuild体系
1. http://blog.csdn.net/yunsongice/article/details/6046537 2. http://blog.csdn.net/yunsongice/articl ...
- Android PhoneGap源码分析——白名单
对于单独的Web app应用来说,加载进来的url一般不能保证它的安全性.那么如何来处理url安全性的问题呢. 让我们来看看PhoneGap是如何做的. PhoneGap采用了白名单的形式,认为在白名 ...
- iOS开发——动画篇Swift篇&动画效果的实现
Swift - 动画效果的实现 在iOS中,实现动画有两种方法.一个是统一的animateWithDuration,另一个是组合出现的beginAnimations和commitAnimation ...
- ios开发——实用技术OC篇》倒计时实现的两种方法
倒计时实现的两种方法 timeFireMethod函数,timeFireMethod进行倒计时的一些操作,完成时把timer给invalidate掉就ok了,代码如下: secondsCountDow ...
- 关于php配置文件
一:配置文件(php.ini)在 PHP 启动时被读取.对于服务器模块版本的 PHP,仅在 web 服务器启动时读取一次.对于 CGI 和 CLI 版本,每次调用都会读取. 二:Note that t ...
- 超级强大的vim配置(vimplus)
vimplus vimplus是vim的超级配置安装程序 github地址:https://github.com/chxuan/vimplus.git,欢迎star和fork. 接触vim到现在也有几 ...