无法删除 SearchResults TableView 单元格后面的行

Can't remove lines behind SearchResultsTableView cells

我正在使用 Objective-C/Xcode 创建一个 iphone 应用程序。我有一个设置,当我单击搜索框时,会显示搜索显示视图,当我在搜索框中键入内容时,searchDisplayController 会加载 searchResultsTableView 单元格,其中包含由自动完成字词组成的行。

因为结果单元格比自动完成单元格大很多,我有以下管理行高的方法:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView == self.searchDisplayController.searchResultsTableView) {
        return 30;
    } else {
        return 90;
    }
}

但是我遇到了一些奇怪的行为,即单元格后面的分隔线显示出来并且看起来很丑。

(为了弄清楚哪些分隔线来自哪里,我使用了

self.searchDisplayController.searchResultsTableView.separatorColor = [UIColor redColor];

)

您知道我如何 remove/hide 这些背景分隔线不显示在此视图中吗?我尝试了各种 color/transparency 和单元格大小操作并搜索了 google/SO 但无法弄清楚。

尝试将您的 tableView 更改为 styleGrouped