TableView中的搜索结果不使用自定义单元格

时间:2012-12-12 20:28:34

标签: tableview uisearchbar uisearchdisplaycontroller

我在表格视图中添加了一个搜索栏,它正在运行并正确返回结果。但是,使用我的自定义单元格显示结果,但基础表不会“拉伸”以适合单元格。我希望这是有道理的。这是我的代码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{


static NSString *CellIdentifier = @"Cell";


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

if (cell == nil) {

    cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];


}

Item *item = nil;

if (tableView == self.searchDisplayController.searchResultsTableView) {

    item = (Item *)[self.filteredItemArray objectAtIndex:indexPath.row];}

else {

    item = (Item *)[self.itemArray objectAtIndex:indexPath.row];}

我认为这与此代码有关。但我不确定。似乎searchResultsTableView不知道自定义单元格...并且自定义单元格只是覆盖在它上面而基础表格不适应它。非常感谢任何帮助!

0 个答案:

没有答案