本文介绍了隐藏UISearchBar明文按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何隐藏或不显示出现在 textField
中的 UISearchBar
交叉 UISearchBar
I would like to know how to hide or not display the UISearchBar
cross that appears in the textField
fo the UISearchBar
我尝试过使用此
filterSearchBar.showsCancelButton = NO;
然而这是一个实际取消按钮而不是小灰色十字架,所以我想知道是否有对于 UISearchBar
中显示的小灰色按钮是等效的。
however this is an acutal cancel button not the small grey cross, so I would like to know if there is an equivilant for the small grey button that shows in the UISearchBar
.
任何帮助都将受到赞赏。
any help would be appreciated.
推荐答案
您需要获取搜索栏的textField:
You need to get the textField of the Search Bar:
UITextField *textField = [searchBar valueForKey:@"_searchField"];
textField.clearButtonMode = UITextFieldViewModeNever;
希望这个帮助! =)
这篇关于隐藏UISearchBar明文按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!