iPhone:在普通视图表中隐藏空表单元格

Bur*_*000 2 iphone uitableview ios

我似乎无法弄清楚如何隐藏没有数据的表格单元格.在分组视图中,每个数据只能获得一个单元格.而在普通视图中,它将单元格渲染到屏幕的底部.我确定它可能因为世界时钟做到了

H6.*_*H6. 5

为了获得这个世界时钟效果,我为UITableView背景设置了一个背景图像,并通过以下方式将表格背景颜色设置为clearColor:

UIImage *image = [UIImage imageNamed:@"background.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[imageView setFrame:self.tableView.bounds];
[self.tableView setBackgroundView:imageView];
[imageView release];
[self.tableView setBackgroundColor:[UIColor clearColor]];
Run Code Online (Sandbox Code Playgroud)

为了摆脱隔板中我已经改变了分离式的,以没有通过

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
Run Code Online (Sandbox Code Playgroud)

对于UITableViewCell,我设置了一个背景颜色(这里:白色):

UIView *cellBackgroundView = [[UIView alloc] init];
[cellBackgroundView setBackgroundColor:[UIColor whiteColor]];
[cell setBackgroundView:cellBackgroundView];
[cellBackgroundView release];
Run Code Online (Sandbox Code Playgroud)