iOS开发之UITextfield
2017-10-27 本文已影响14人
LearningCoding
修改placeholder颜色
1、通过 attributedPlaceholder 属性
UIColor *color = ;
_userName.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"用户名" attributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];
2、KVC
[_userName setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];