没有反应的UISearchBar

时间:2013-10-08 17:12:28

标签: iphone ios objective-c

我为UISearchBar实施了UIViewController并添加了所有必要的代理以使其正常运行,问题是UISearchBar有时会变得无法响应无论我在iPhone中使用什么磁带键盘都没有显示在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];

    }

}

0 个答案:

没有答案