在我的 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
方法中,是否可以不使用某些单元格填充我的 TableView ?
现在我的方法看起来像这样:
static NSString *CellIdentifier = @"Cell";
ResultsCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.title.text = [[resultsForCell objectAtIndex:indexPath.row] objectForKey:@"title"];
return cell;
但我想这样做,如果 objectforkey@"title"等于某个东西,它不会显示在 tableview 上或不返回该单元格。我不知道完成此任务的最佳方法。
最佳答案
如果你想“过滤”你的 TableView ,你需要过滤你的源数据。在这种情况下,您需要从 resultsForCell 中删除这些值。
如果您想隐藏这些单元格上的标签,只需将标签的隐藏设置为 true 即可。
关于iphone - 如何有条件地不返回单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17936377/