第一种方式:
KVC的方式
textField.placeholder = @"username is in here!";
[textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];
[textField setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:@"_placeholderLabel.font"];
第二种方式:
设置 attributedPlaceholder属性
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:@"搜索" attributes:
@{NSForegroundColorAttributeName:[UIColor grayColor],
NSFontAttributeName:[UIFont boldSystemFontOfSize:12]}
];
searchTextField.attributedPlaceholder = attrString;