0

に を実装しUISearchBar、必要なデリゲートUIViewControllerをすべて追加して機能させました。戻る。私のコードの問題は何ですかUISearchBarUISearchBarUIViewController

@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];

    }

}
4

0 に答える 0