原理是通过KVC来实现
//获取searchBar里面的TextField
UITextField*searchField = [_searchBar valueForKey:@"_searchField"];
//更改searchBar 中PlaceHolder 字体颜色
[searchField setValue:[UIColor blackColor] forKeyPath:@"_placeholderLabel.textColor"];
//更改searchBar输入文字颜色
searchField.textColor= [UIColor blackColor];
网友评论