【发布时间】:2012-05-20 18:59:29
【问题描述】:
如何隐藏空的 UITableCells?我的 Tablecell 包含背景,所以我尝试了这行代码
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 100)];
view.backgroundColor = [UIColor whiteColor];
return view;
}
但它不起作用(因为我的 uitablecell 背景)
背景:
[tabelView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"table.png"]]];
【问题讨论】:
-
我不明白为什么表格单元格会存在,如果它们是空的。当您的数据源被询问单元格的数量时,为什么不只返回您需要的“非空”单元格的数量?
-
“隐藏”是什么意思?您想要表格中的间隙(即中间)还是只有表格中的最后一个单元格(即最底部的单元格)是空的?
-
我的意思是 uitablecells 的单独行我如何隐藏它们
-
您想隐藏 tableview 单元格,但您已经发布了 viewforfooterinsection 的代码。您能否在 cellforrowinindexpath 中发布您的代码?还有你说的空是什么意思?
标签: objective-c xcode ios5