We have a UITableView and it was working fine for iOS7 but when I tried in the iOS8 simulator, I saw the cell separator was placed incorrectly for most cells. Strangely, some cells display the separator correctly.
See the attached image:
I set the cell height this way:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 70.0f;
}
Do you know what's happening? Thanks!
EDIT:
A workaround I'm using in the meantime is to disable the separator...
[tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
...and paint it myself in the cell view...
UIView* separator = [[UIView alloc] initWithFrame:CGRectMake(20, cellHeight-1, frame.size.width - 40, 1)];
separator.layer.borderWidth = 1;
separator.layer.borderColor = [[UIColor grayColor] CGColor];
[self addSubview:separator];
...but I'd like not to do it.
I had the same problem and here is how I solved it:
If you are using a custom cell for your table view and you have overridden layoutSubviews, you need to call it's superview's method at the beginning of the method:
- (void)layoutSubviews
{
[super layoutSubviews];
// Your implementation
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With