把UISearchController的cancel按钮自定义中文取消

- (void)updateSearchResultsForSearchController:(UISearchController *)searchController{

searchController.searchBar.showsCancelButton = YES;

for(id cc in [searchController.searchBar.subviews[0] subviews])

{

if([cc isKindOfClass:[UIButton class]])

{

UIButton *btn = (UIButton *)cc;

[btn setTitle:@"取消" forState:UIControlStateNormal];

}

}

}

或者是。[_searchVC.searchBar setValue:@"取消" forKey:@"_cancelButtonText"];

你可能感兴趣的:(把UISearchController的cancel按钮自定义中文取消)