I'm having trouble changing the text of the searchbar cancel button.
See my code:
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
{
[_srBar setShowsCancelButton:YES animated:YES];
UIButton *cancelButton = nil;
for (UIView *subView in searchBar.subviews) {
if ([subView isKindOfClass:NSClassFromString(@"UIButton")]) {
cancelButton = (UIButton*)subView;
}
}
[cancelButton setTitle:@"Annuller" forState:UIControlStateNormal];
}
Also I already tried other options
iOS Change the title of cancel button in UISearchBar iOS - Customizing Cancel button of UISearchBar
In this example my code does not call the method
How to change the default text of Cancel Button which appears in the UISearchBar +iPhone
my scenery
#import <UIKit/UIKit.h>
@interface favorito : UIViewController<UISearchControllerDelegate, UISearchDisplayDelegate, UISearchBarDelegate,UITableViewDelegate,UITableViewDataSource>
@end