UISearchBar 按钮的文字和颜色更改
设置 取消 按钮的颜色 为 黑色(这个方法是google来的)
[[UIBarButtonItem appearanceWhenContainedIn: [UISearchBar class], nil] setTintColor:[UIColor blackColor]];
至于更改cancel按钮为 “取消”按钮
- (void)searchBarTextDidBeginEditing:(UISearchBar *)hsearchBar { self.searchBar.showsCancelButton = NO; for(id searchButton in [self.searchBar subviews]) { if([searchButton isKindOfClass:[UIButton class]]) { [(UIButton *)searchButton setTitle:@"取消" forState:UIControlStateNormal]; } } }
未完待续