1

I have a UITableView with Custom Headers but I can't remove the bottom white line inside. The Separator property is set to none, in fact, the cells in the section don't have the line.

-(UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
static NSString *CellIdentifier = @"DashboardSectionHeader";
UITableViewCell *headerView = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    ...
    return headerView;
}

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

enter image description here

10
  • Try return height 55 in heightForHeaderInSection and see if the line still appears. Commented Oct 22, 2015 at 12:10
  • It appears with any height
    – Vins
    Commented Oct 22, 2015 at 12:12
  • Did you try setting separator color to clear color? Commented Oct 22, 2015 at 12:13
  • @tnylee yes but it doesn't work
    – Vins
    Commented Oct 22, 2015 at 12:15
  • I think your tableviewCell is having a one pixel space at the top.Just check. Commented Oct 22, 2015 at 12:16

2 Answers 2

1

Have you checked DashboardSectionHeader cell?If there is a line at the bottom.Try changing the backgroundcolor of this cell and see.If the line is appearing in the section view ,then there should be say a one pixel space at the bottom of this cell through which the background will be visible.

0

I had the same issue in the same circumstances as you, and for me the problem have been solved by adding:

cell.contentView.clipsToBounds = NO;

in tableView: viewForHeaderInSection: method. Or you can just uncheck Clip Subview property in Attribute Inspector for your cells Content View (in Storyboard or xib file). FYI, I kept this property checked for my TableViewCell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.