// 设置Cancel Button的文字
UISearchBar *searchBar = [[UISearchBar alloc] init];
[searchBar setValue:@"取消" forKey:@"_cancelButtonText"];
// 设置占位符的颜色
UITextField *textField = [searchBar valueForKey:@"_searchField"];
[textField setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];
网友评论