I tried:
UITextField *searchtextfield = [searchBar.subviews objectAtIndex:1]; UIButton *cButton = [UIButton buttonWithType:UIButtonTypeCustom]; cButt
In swift 2.2, following code worked for me
[UISearchBar .appearance().setImage(UIImage(named: "search_clear_icon"), forSearchBarIcon: .Clear, state: .Normal)] [UISearchBar .appearance().setImage(UIImage(named: "search_clear_icon"), forSearchBarIcon: .Clear, state: .Highlighted)]