我使用viewForHeaderInSection创建了一个自定义的UITableView标头,初始外观看起来很棒。但是,当我将屏幕上的标题滚动并返回时,我的第二个标题页顶部会有一个额外的细线分隔符。当我滑动删除项目标题上方的项目时,我也可以显示它。值得注意的是,顶部标题没有这个问题,只有第二部分标题以及更远。
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { if (section == 0) {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 18)];
[view setBackgroundColor:[UIColor colorWithRed:248.0/255.0 green:248.0/255.0 blue:248.0/255.0 alpha:1.0]];
UIView *topLine = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 0.5)];
UIView *bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0, 38.5, tableView.frame.size.width, 0.5)];
topLine.backgroundColor = [UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0];
bottomLine.backgroundColor = [UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0];
[view addSubview:topLine];
[view addSubview:bottomLine];
return view;
}}
答案 0 :(得分:0)
你的细胞中是否有分隔物?您可能会看到标题中的topLine与其上方单元格中的分隔符重叠。