解决UITabeleViewCell的分割线不能铺满问题

时间:2023-03-09 20:16:14
解决UITabeleViewCell的分割线不能铺满问题

-(void)viewDidLayoutSubviews {

if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {

[self.tableView setSeparatorInset:UIEdgeInsetsZero];

}

if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)])  {

[self.tableView setLayoutMargins:UIEdgeInsetsZero];

}

}

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

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

[cell setLayoutMargins:UIEdgeInsetsZero];

}

if ([cell respondsToSelector:@selector(setSeparatorInset:)]){

[cell setSeparatorInset:UIEdgeInsetsZero];

}

}