Hide UISearchBar clear text button

ios, objective-c, uisearchbar, uitextfield

Solution

You need to get the textField of the Search Bar:

UITextField *textField = [searchBar valueForKey:@"_searchField"];
textField.clearButtonMode = UITextFieldViewModeNever;

hope this help! =)

Problem

I would like to know how to hide or not display the `UISearchBar` cross that appears in the `textField` fo the `UISearchBar` I have tried using this ``` filterSearchBar.showsCancelButton = NO; ``` However this is an actual cancel button not the small grey cross, so I would like to know if there is an equivalent for the small grey button that shows in the `UISearchBar`.

Original source