iOS修改UITextField的Placeholder字体颜色

 修改UITextField的Placeholder字体颜色有一下两张方式可以达到效果。

 

第一种: 

UIColor *color = [UIColor whiteColor];

textfield.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"用户名" attributes:@{NSForegroundColorAttributeName: color}];

 

第二种: 

[textfield setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];

  

原文地址:https://www.cnblogs.com/FranZhou/p/5127742.html