iPhone UITextField – Change placeholder text color
但是并没有保持现有的属性,如对齐,字体等…什么是更好的方法来解决这个问题?
没有任何子类化,可以通过几行代码来实现这一点:
UIColor *color = [UIColor blackColor]; textField.attributedplaceholder = [[NSAttributedString alloc] initWithString:placeholderText attributes:@{NSForegroundColorAttributeName: color}];