使用UITextField的共有屬性attributedPlaceholder
self.textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeHolder attributes:@{NSForegroundColorAttributeName: YHGrayColor_51}];
- (void)drawRect:(CGRect)rect
{
? ? UIColor *color = [UIColor redColor];
? ? self.textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeHolder attributes:@{NSForegroundColorAttributeName: color}];
}