UITextField设置placeholder颜色
2015-10-25 00:00
477 查看
方式一:
_codeTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"请输入验证码(4位数字)" attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:kTextLightGray]}];
方式二:KVC方式
_phoneTextField.placeholder = @"请输入手机号码";
[_phoneTextField setValue:[UIColor colorWithHex:kTextLightGray] forKeyPath:@"_placeholderLabel.textColor"];
_codeTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"请输入验证码(4位数字)" attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:kTextLightGray]}];
方式二:KVC方式
_phoneTextField.placeholder = @"请输入手机号码";
[_phoneTextField setValue:[UIColor colorWithHex:kTextLightGray] forKeyPath:@"_placeholderLabel.textColor"];
相关文章推荐
- UIButton 的不同设置和UITextField 的默认值(修改默认值)
- UIView 设置边框颜色 和 UILabel 的设置
- 给uiview 添加边框以及圆角
- easyui-datagrid的url中的中文问题
- 每次保存之后build workspance 速度很慢的解决办法
- IOS--UIAlertViewDelegate对对话框的事件处理方法
- IOS-- UIAlertView(对话框)
- IOS---UIActivityIndicatorView
- 二、文件与目录
- The Dole Queue 约瑟夫环 模拟
- 从头认识java-3.2 return break continue
- 从头认识java-3.2 return break continue
- DP-POJ-2533-Longest Ordered Subsequence
- boost::lockfree::queue记录
- EasyUI - NumberBox组件
- LeetCode60——Permutation Sequence
- LeetCode之Unique Binary Search Trees & Unique Binary Search Trees II
- 知识库系统confluence5.8.10 安装与破解
- 用UIButton实现各种图文结合功能
- Android build.prop 添加自定义项 及使用