textField.placeholder = @"username is in here!";
[textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];
[textField setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:@"_placeholderLabel.font"];
这里是使用了KVC的方式,是不是很简单呢?呵呵!
更详细请参考原文:标哥的技术博客
本文介绍如何使用KVC方式轻松自定义UITextField中的占位符颜色及字体大小,适用于iOS应用开发。
551

被折叠的 条评论
为什么被折叠?



