UISearchDisplayController 自定义取消按钮标题
2014-11-12 18:00
399 查看
#pragma UISearchDisplayDelegate
-(void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller{
[mySearchBar
setShowsCancelButton:YES
animated:NO];
UIView *topView = controller.searchBar.subviews[0];
for (UIView *subView
in topView.subviews) {
if ([subView
isKindOfClass:NSClassFromString(@"UINavigationButton")]) {
UIButton *cancelButton = (UIButton*)subView;
[cancelButton setTitle:@"取消"
forState:UIControlStateNormal];
}
}
}
-(void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller{
[mySearchBar
setShowsCancelButton:YES
animated:NO];
UIView *topView = controller.searchBar.subviews[0];
for (UIView *subView
in topView.subviews) {
if ([subView
isKindOfClass:NSClassFromString(@"UINavigationButton")]) {
UIButton *cancelButton = (UIButton*)subView;
[cancelButton setTitle:@"取消"
forState:UIControlStateNormal];
}
}
}
相关文章推荐
- ios7 UISearchDisplayController cancel button title 自定义取消按键标题
- 在UISearchDisplayController里定义取消按钮和去掉No Result
- 点击搜索取消UISearchDisplayController的搜索状态
- 点击搜索取消UISearchDisplayController的搜索状态
- 自定义UISearchBar和UISearchDisplayController
- IOS:自定义UISearchDisplayController的cancel和no results
- 自定义UISearchDisplayController中搜索到结果的cell的位置
- iOS开发 UISearchController的cancel按钮自定义中文取消,改变按钮标题颜色,去掉边框线
- 点击搜索取消UISearchDisplayController的搜索状态
- iOS中的两种搜索方式UISearchDisplayController和UISearchController
- IOS UISearchDisplayController 点击搜索出现黑条问题解决方案
- UISearchDisplayController 去除“No Results”,“无结果” 的显示方法
- IOS UISearchBar + UISearchDisplayController使用
- UISearchBar和 UISearchDisplayController的使用
- iOS UISearchBar 和 UISearchDisplayController的使用
- 自定义提示框(alert、confirm 可自定义标题 内容 图标 取消按钮)
- 自定义提示框(alert、confirm 可自定义标题 内容 图标 取消按钮)
- UISearchDisplayController的searchResultsTableView的Contentsize不正确的问题
- iOS开发-UI控件:关于使用UISearchDisplayController
- UISearchBar和UISearchDisplayController