我希望tableView不加载包含某些字符串的单元格,该怎么做?
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
NSString *itemTitle = item.title;
if ([item.title isEqualToString: @"Some string"])
{
// Help needed
}
else
{
cell.textLabel.font = [UIFont boldSystemFontOfSize:15];
cell.textLabel.text =itemTitle;
}
return cell;
答案 0 :(得分:0)
- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
更好的选择是在加载表格之前更新您的数据。
如果以上两种方法都失败,那么您可以尝试以下方法
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
如果您不希望细胞出现在屏幕上,请返回0。可能不会出现高度为0的单元格。
如果以上不起作用,请在此发布,以便我可以进一步协助....