我想知道如何隐藏或不显示 UISearchBar
的 textField
中出现的 UISearchBar
叉号
我试过用这个
filterSearchBar.showsCancelButton = NO;
然而,这是一个实际的取消按钮,而不是灰色的小十字,所以我想知道 UISearchBar
中显示的灰色小按钮是否有等效项。
最佳答案
您需要获取搜索栏的 textField:
UITextField *textField = [searchBar valueForKey:@"_searchField"];
textField.clearButtonMode = UITextFieldViewModeNever;
希望对您有所帮助! =)
关于ios - 隐藏 UISearchBar 明文按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21522104/