ios开发解决cell的分割线左侧部分缺失的方法

-(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];

    }

}

猜你喜欢

转载自blog.csdn.net/denggun12345/article/details/54906491