Iphone 无响应的UISearchBar

Iphone 无响应的UISearchBar,iphone,ios,objective-c,Iphone,Ios,Objective C,我在UIViewController上实现了一个UISearchBar,并添加了所有必要的代理以使其正常工作,问题是UISearchBar有时会无响应,我在iPhone键盘上录制的任何内容都不会出现在UISearchBar上,尤其是当我按下一个新的UIViewController并将其弹出时。我的代码有什么问题 @interface ViewController : UIViewController <UIAlertViewDelegate, UISearchBarDelegate>

我在
UIViewController
上实现了一个
UISearchBar
,并添加了所有必要的代理以使其正常工作,问题是
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];

    }

}
@界面ViewController:UIViewController{
IBUISearchBar*搜索栏;
}
-(无效)视图显示:(BOOL)动画{
[超级视图显示:是];
SearchBar.delegate=self;
}
-(无效)搜索栏搜索按钮选中:(UISearchBar*)搜索栏{
[自视图编辑:是];
如果(SearchBar.text.length<3){
UIAlertView*警报=[[UIAlertView alloc]initWithTitle:@“”
信息:@“至少3克拉”
代表:赛尔夫
取消按钮:无
其他按钮提示:@“OK”,无];
[警报显示];
[警报发布];
}否则{
self.Array=[[NSMutableArray alloc]init];
[自我获取数据];
}
}

您是否尝试在方法中设置断点?另外,您不需要SearchBar.delegate=self;在viewDidLoad中这样做是不够的,请检查主线程是否阻塞。如果你在主线程上进行网络调用,你的应用程序将冻结,你说断点是什么意思?