Tableviewcell separator moved to ios 8

I am creating table views and cells programmatically. Table cell selector moved in iOS 8.

enter image description here

even if i already installed:

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return kSomeNumber;
}

      

My app is ios7 and my phone is ios8. What could be the problem? I cannot use cell.layoutMargins which is for ios8 only

+3


source to share


1 answer


As of iOS8, we have layoutMargins that calls your string.

If you have a custom cell, add this method to remove it:

- (UIEdgeInsets)layoutMargins 
{
     return UIEdgeInsetsZero;
}

      

Or add this to your uitableviewcontroller:



-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{

   if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
   }
}

      

To support iOS7

a response switch is required,

Also check iOS 8 UITableView separator inset 0 not working for more info

+5


source







All Articles