2011-03-10 6 views
1

여기에 약간의 문제가 있습니다. 텍스트를 입력 할 때 검색 막대가 검색되는 이유는 무엇입니까? 코드는 다음과 같습니다.목표 C UISearchBar

 - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { 
     [searchBar setShowsCancelButton:YES animated:YES]; 
     self.theTableView.allowsSelection = NO; 
     self.theTableView.scrollEnabled = NO; 
     [theTableView setRowHeight:110]; 
    } 

    - (void)searchDisplayController:(UISearchDisplayController *)controller willShowSearchResultsTableView:(UITableView *)tableView { 
     [tableView setRowHeight:[[self theTableView] rowHeight]]; 
     tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 
     [self.tableData removeAllObjects]; 
    } 

    - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { 
     [email protected]""; 

     [searchBar setShowsCancelButton:NO animated:YES]; 
     [searchBar resignFirstResponder]; 
     self.theTableView.allowsSelection = YES; 
     self.theTableView.scrollEnabled = YES; 
    } 

    - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { 

     // all the function to search 

    } 

답변

1

searchDisplayController:shouldReloadTableForSearchString:을 구현하고 NO를 반환합니다. 이렇게하면 검색하는 동안 데이터 자동로드가 금지됩니다.

+0

Perfect. 감사. –

+0

테이블에서 다시로드하려는 경우, 그물에서 새 데이터를 가져온 다음에는 어떻게해야합니까? 나는 무엇을 할 것이냐? –