ios textField 修改 placeholder color 颜色

使用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}];

}

你可能感兴趣的:(ios textField 修改 placeholder color 颜色)