UITableView separator lines fade between cells in scroll

Problem: The separator between cells in the table view is displayed only for those cells that are displayed when the view is loaded and only during loading. When the table view scrolls down, the cells scrollable in the view window do not show the separator between them, and then, when the table scroll is viewed, the original cells do not show the separator.

Details: I have a UITableView to which I am adding a standard UITableViewCells. These cells are created using initWithFrame, frame height = 90 pixels. I am adding a custom view created from nib for this cell view, height = 90px. The cell height is specified in 90 pixels in the table View: heightForRowAtIndexPath :.

Has anyone experienced this behavior?

+5
source share
4 answers

I had the feeling that the solution to this would be simple ... I made my cell height 91px, and the separator lines look like they should on the scroll.

+6
source

Douglas, . .

, contentView :

yourTable.separatorColor = [UIColor clearColor];
separatorView.frame = FactRectMake(0, rowHeight-1, appFrame.size.width, 0.2);
+3

, . , , :

for (UIView *eachView in self.subviews) {
    [eachView removeFromSuperview];
}

!

( ) :

tempFirstNameLabel.tag = 100;
self.firstNameLabel = tempFirstNameLabel;
[self addSubview:self.firstNameLabel];

, , :

for (int i = 100; i<103; i++) {
    UIView *eachView = [self viewWithTag:i];
    [eachView removeFromSuperview];
}

, ! , @Douglas Smith.

+3
source

You must set the separator to none, and then one line again

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    // it is a bug in iOS 7
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
+1
source

All Articles