2011-12-05 48 views
1

使用UISearchDisplayController當我使用UIStoryboard在我的iPhone項目,並有一個控制器,它的UITableViewController的子類,有UISearchDisplayController。無細胞上UIStoryBoard

在的tableView:的cellForRowAtIndexPath,我正在使用電池:

MyCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

的CellIdentifier是我的原型細胞的標識符。當顯示錶格行時,這很好,但是一旦我編輯了搜索欄,並且試圖顯示搜索結果的視圖,我得到了零個單元格。

回答

3

補充一點:

if (cell == nil) { 
    cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
} 

而且,如果像我一樣,你改變了你的表格單元格行rowHeight時,你需要實現這個方法太

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    return self.tableView.rowHeight; 
}