When i invoke the searchBar object into the UISearchBar delegate methods like this, it works fine:
-(void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{
NSLog(@"You have taped:%@",searchBar.text);
[searchBar resignFirstResponder];
searchBar.showsCancelButton=NO;
}
However, when i try to use it into another method from my own, i got that error:
use of undeclared identifier searchBar
I don’t know why and how to resolve this.
it means you don’t have the searchBar variable defined. You’ll need to create a member variable, probably as an IBOutlet so you can use it outside the scope of that function.