UISearchBar *searchBar = [UISearchBar new];
UITextField *searchField = [searchBar valueForKey:@"_searchField"];
// 输入文本颜色
searchField.textColor = [UIColor blackColor];
// 默认文本颜色
[searchField setValue:[UIColor blackColor] forKeyPath:@"_placeholderLabel.textColor"];
//第2种方法
//设置属性字符串,设置好想要的颜色和文本
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:@"默认文本" attributes:[NSDictionary dictionaryWithObject:UIColorFromRGB(198.0, 198.0, 198.0) forKey:NSForegroundColorAttributeName]];
//修改默认文本
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setAttributedPlaceholder:attributedString];