に を実装しUISearchBar
、必要なデリゲートUIViewController
をすべて追加して機能させました。戻る。私のコードの問題は何ですかUISearchBar
UISearchBar
UIViewController
@interface ViewController : UIViewController <UIAlertViewDelegate, UISearchBarDelegate> {
IBOutlet UISearchBar * SearchBar ;
}
-(void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:YES];
SearchBar.delegate = self ;
}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
[self.view endEditing:YES];
if(SearchBar.text.length < 3){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@""
message:@"Votre recherche doit contenir 3 caractères minimum"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"OK", nil];
[alert show];
[alert release];
}else{
self.Array = [[NSMutableArray alloc] init];
[self getData];
}
}