I have a simple view controller with a uisearchbar and a uitable. My problem is that when search bar is tapped I see delegate function searchBarShouldBeginEditing being called but not searchBarTextDidBeginEditing(and because of that keyboard is not opened and search is not editable)
I tried to implement delegate function searchBarShouldBeginEditing returning YES, set searchbar as first responder, but no way I get searchBarTextDidBeginEditing called...
Any idea what could be happening??
Some code:
controller.h
@interface ViewController : UIViewController <UISearchBarDelegate>
{
UISearchBar * searchbar;
}
@property (nonatomic, retain) IBOutlet UISearchBar* searchbar;
@end
controller.m
@synthesize searchbar;
- (BOOL)respondsToSelector:(SEL)sel {
NSLog(@"Queried about %@", NSStringFromSelector(sel));
return [super respondsToSelector:sel];
}
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {
NSLog(@"searchBarShouldBeginEditing -Are we getting here??");
return YES;
}
-(void) searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
NSLog(@"searchBarTextDidBeginEditing -Are we getting here??");
}
Of cousrse my class have plenty more code (that surely is affecting somehow searchbar) but if someone has got similar problems with searchbar it would be very apreciated its response ;)
I tryed to make simple application with only searchbar and obviously it works...
EDITING:
Testing a little bit I discovered that it is not something related with uisearchbar as I added a TextField getting same result (just textFieldShouldStartEditing delegate function being called)
Application has all view controllers inside a UITabBar cotroller, but I do not think this can cause all this mess...
EDITING2:
Really strange behaviour: Setting IBAction function to TouchDown event of a UITextfield works perfectly but setting IBAction function to EditingDidBegin never gets fired...
Why this event could not be called??
did you set the delegate property?