Objective c 搜索栏:shouldChangeTextInRange:replacementText未调用

Objective c 搜索栏:shouldChangeTextInRange:replacementText未调用,objective-c,ios,iphone-developer-program,Objective C,Ios,Iphone Developer Program,搜索栏:shouldChangeTextInRange:replacementText从未调用。委托已定义,方法–SearchBar应开始编辑:和SearchBarTextDidBeginEdit:工作正常,但不调用应更改范围内的文本。我发现,当setp在一个使用alertview的方法中时,在我尝试使用搜索栏之后,..shouldChangeTextInRange被调用…但在未调用之前 -(void) searchBarTextDidBeginEditing:(UISearchBar *)se

搜索栏:shouldChangeTextInRange:replacementText从未调用。委托已定义,方法–SearchBar应开始编辑:SearchBarTextDidBeginEdit:工作正常,但不调用应更改范围内的文本。我发现,当setp在一个使用alertview的方法中时,在我尝试使用搜索栏之后,..shouldChangeTextInRange被调用…但在未调用之前

-(void) searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
     }

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
{
 return YES;
}

-(BOOL)searchBar:(UISearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
 return YES;
}


-(BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar {
return  YES;
 }

 -(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {

  }

我错过了appDelegate中的以下代码,ApplicationIDFinishLauching


现在搜索栏工作正常

我做了一个测试并在视图中放置了一个alertview加载了…搜索栏工作了…但我不想要alertview:S
 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window makeKeyAndVisible];