I have an UISearchBar
which i implemented in my viewDidLoad
: by code.
I have also set the UISearchBarDelegate
.
Now i want to restrict the user from entering more than 5 chracter So i implement this delegate method
- (BOOL)searchBar:(UISearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
NSLog(@"shouldChangeTextInRange");
if (searchBar.text.length >= 5)
return NO;
return YES;
}
Its working fine.
The problem is when i typed upto 5 chracters & try to use the keyboard Backspace character, it is not working.
Also now if i pressed Search button in keyboard the searchBarSearchButtonClicked
: is not getting called.
I am currently using
XCode version :3.2.5
iOS SDK :4.2