设置 UISearchBar 输入字体颜色 和placeHold
2016-02-25 本文已影响2836人
GodfansMa
原理是通过KVC来实现
//获取searchBar里面的TextField
UITextField*searchField = [_searchBar valueForKey:@"_searchField"];
//更改searchBar 中PlaceHolder 字体颜色
[searchField setValue:[UIColor blackColor] forKeyPath:@"_placeholderLabel.textColor"];
//更改searchBar输入文字颜色
searchField.textColor= [UIColor blackColor];