在搜索结果的末尾添加“搜索”单元格,如Instagram

时间:2013-11-05 17:36:23

标签: ios objective-c uitableview

我通过数组进行搜索过滤,效果很好。但是,我想在最后添加一个额外的单元格,基本上是“搜索%@”,其中%@是搜索查询。单击此单元格时,它将从php查询中加载新的表视图。

根据我的理解,我可能会使用新的2个原型单元格,其中一个进入新的表视图,另一个进入视图控制器以获得结果。

然而,每当我尝试任何东西时,我都遇到了一堆乱例。有人可以提供指导吗?

现在我的cellForRowAtIndexPath代表看起来像这样:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *simpleTableIdentifier = @"SimpleTableItem";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
    }

    if (tableView == self.searchDisplayController.searchResultsTableView) {
        cell.textLabel.text = [filteredPeople objectAtIndex:indexPath.row];
    } else {
        cell.textLabel.text = [followers objectAtIndex:indexPath.row];
    }


    return cell;
}

0 个答案:

没有答案