本文介绍了如何覆盖UISearchBar中的取消按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在使用以下方法停止取消按钮项目显示在搜索栏中。我有一个我想要使用的自定义 UIButton 。
I am currently using the following method to stop the cancel button item from showing up in the search bar. I have a custom UIButton that I would like to use instead.
问题在于目前已构建在取消按钮仍然显示。
The problem is that at the moment the built in cancel button is still showing up.
- (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller { controller.searchBar.showsCancelButton = NO; }感谢您的帮助
推荐答案您可以使用此隐藏取消按钮
You can hide your cancel button using this
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { [searchBar setShowsCancelButton:NO animated:YES]; }更多推荐
如何覆盖UISearchBar中的取消按钮
发布评论