When I click on the search bar, I want to get a string that has already been entered. For this, I am currently using this method:
- (BOOL)searchBar:(UISearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
NSLog(@"String:%@",mainSearchBar.text);
return YES;
}
But it returns the previous line. For example, id I type "jumbo", it shows jumb and when I press backspace to remove one element and make it "jumb", it shows jumbo. those. previous line in the search bar.
What should I do to get the current row? plsease help. Thanks
source
share