我有一個UISearchDisplayController正確連接在Interface Builder中。UISearchDisplayController不顯示任何單元格
delegate = Files Owner
searchBar = Search Bar
searchContentsController = Files Owner
searchResultsDataSource = Files Owner
searchResultsDelegate = Files Owner
當我的UITableView調用numberoOfRowsInSection:
時,返回正確的編號。
然而,我在cellForRowAtIndexPath:
細胞甚至不到:
- (UITableViewCell *)tableView:(UITableView *)tblView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tblView == searchController.searchResultsTableView){
NSLog(@"search will go here");
UITableViewCell* cell = [self provideSearchQueryCells:tblView identifer:@"searchQueryCell"];
STSymbol *aSymbol = [self.searchQueryResults objectAtIndex:indexPath.row];
cell.textLabel.text = aSymbol.symbol;
cell.detailTextLabel.text = aSymbol.symbol_title;
return cell;
}
else { ... }
它總是轉到其他條件。
我不完全確定爲什麼。
我相信是這樣的,因爲這個代碼在一個UITableViewController子類。 self.searchResultsTableView不是UITableViewController中的屬性。 – 2010-08-13 04:48:44
我修改了我的帖子,以顯示代表如何在IB中聯繫。 – 2010-08-13 05:23:48