// // UITableViewCell+RQExtension.m // jiaPei // // Created by 张嵘 on 2020/6/19. // Copyright © 2020 JCZ. All rights reserved. // #import "UITableViewCell+RQExtension.h" @implementation UITableViewCell (RQExtension) - (void)drawRect:(CGRect)rect { [super drawRect:rect]; UITableView *superView = (UITableView *)self.superview; if (![superView isKindOfClass:[UITableView class]]) { superView = (UITableView *)self.superview.superview; } if ([superView isKindOfClass:[UITableView class]]) { NSIndexPath *indexPath = [superView indexPathForCell:self]; NSInteger rows = [superView numberOfRowsInSection:indexPath.section]; self.separatorInset = UIEdgeInsetsMake(0, 15, 0, 0); if(indexPath.row == rows -1) { self.separatorInset = UIEdgeInsetsMake(0, 0, 0, KScreenwidth); } else { self.separatorInset=UIEdgeInsetsMake(0, 15, 0, 0); } } } @end