I'm creating tableviews and cells programmatically. The tableview cell separator moved in iOS 8,

even if I have already set:
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return kSomeNumber;
}
My app is ios7 and my phone is ios8. What could be the problem? I can't use cell.layoutMargins which is for ios8 only
Since iOS8 we have layoutMargins which is causing your line.
If you have a custom cell, add this method to remove it:
- (UIEdgeInsets)layoutMargins
{
return UIEdgeInsetsZero;
}
Or add this in you uitableviewcontroller:
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
The responsToSelector is needed in order to support iOS7
Also check iOS 8 UITableView separator inset 0 not working for more info
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