I have an UISearchBar which i implemented in my viewDidLoad: by code. I have also set the UISearchBarDelegate.
UISearchBar
viewDidLoad
UISearchBarDelegate
Now i want to rest
You can't use backspace because of your code. after typing 5 characters, your searchBar is stuck. Use it instead :
if ([textField.text length] + [string length] - range.length > 5) { return NO; }