UISearchBar的一些设置
2016-06-20 本文已影响125人
小黄人写代码
// 设置Cancel Button的文字
UISearchBar *searchBar = [[UISearchBar alloc] init];
[searchBar setValue:@"取消" forKey:@"_cancelButtonText"];
// 设置占位符的颜色
UITextField *textField = [searchBar valueForKey:@"_searchField"];
[textField setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];