2012-03-10 18 views
3

是有辦法我可以有在搜索結果中控制器表查看完全相同的樣式(高度,背景等)我有在iOS5的我的tableview控制器的原型細胞?UITableView的控制器與原型自定義單元格和搜索顯示控制器的tableview

根視圖具有一個背景圖像和一個特定的單元高度。搜索表不顯示背景圖片,單元格高度較低;

+2

其實很容易。 (void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView {0} {0}並將樣式代碼放在那裏 – 2012-03-10 21:36:45

回答

4

另一種方法是隻使用相同的小區標識符(至少如果您使用的故事板),因此,例如:

static NSString *CellIdentifier = @"searchCell"; 
myCustomCell *cell = (myCustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

//for search controller need to check if cell is nil, if it is create one since there won't be any to reuse to begin with 
if (!cell) { 
    cell = (myCustomCell *)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator]; 
} 

其它性能如行高度等可以通過訪問的屬性中設置

self.searchDisplayController.searchResultsTableView 
相關問題