美文网首页
iOS开发之UITextfield

iOS开发之UITextfield

作者: LearningCoding | 来源:发表于2017-10-27 18:35 被阅读14次

修改placeholder颜色
1、通过 attributedPlaceholder 属性
UIColor *color = ;
_userName.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"用户名" attributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];
2、KVC
[_userName setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];

相关文章

网友评论

      本文标题:iOS开发之UITextfield

      本文链接:https://www.haomeiwen.com/subject/lvtsottx.html