0

我正在尝试将静态 UITableView 放入 UIViewController 正如您从图像中看到的那样,我现在面临的问题是

在此处输入图像描述

这是一个“普通”模式(而不是“分组”)的 UITableView 您可以看到底线(表格结束的地方)正确显示。但是顶部没有线(表格开始的地方)。

有没有什么办法可以通过编程或通过xcode在其中添加一行,而不仅仅是拖入一个灰色背景且高度为1点的UIView?

谢谢

4

1 回答 1

1

尝试设置一个 1 像素宽的标题

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 1;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)]; //It will stretch
    view.backgroundColor = [UIColor grayColor];
}
于 2013-10-16T02:41:31.843 回答