The searchBar:shouldChangeTextInRange:replacementText never called. The delegate is defined, the methods – searchBarShouldBeginEditing: and searchBarTextDidBeginEditing: works fine but the shouldChangeTextInRange not called. I discovered that when setp in a method that use alertview and after I try to use the searchbar..the shouldChangeTextInRange is called...but before not
-(void) searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
}
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
{
return YES;
}
-(BOOL)searchBar:(UISearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
return YES;
}
-(BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar {
return YES;
}
-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
}
I have missed the code below in appDelegate , applicationDidFinishLauching
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window makeKeyAndVisible];
Now the SearchBar is working fine!