我有一個UITableView一個UISearchBar和我的實現如下:的UISearchBar失去焦點
-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
[self.searchBar becomeFirstResponder];
if(searchText.length == 0)
{
self.isFiltered = NO;
}
else
{
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF.writer1 contains[c] %@", searchText];
self.isFiltered = YES;
[[RTRepairOrderStore sharedStore] filterROArray:predicate];
}
[self.tableView reloadData];
}
的問題是,當我鍵入一個字母在搜索欄中,搜索工作,但鍵盤被立即解僱。我怎樣才能防止這一點?