天天看點

UItableViewCell的分割線頂頭顯示

實作如下代理方法即可

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
    
    
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}


- (void)viewDidLayoutSubviews {
    if ([self.tableViewOne respondsToSelector:@selector(setSeparatorInset:)]) {
        [self.tableViewOne setSeparatorInset:UIEdgeInsetsZero];
    }
    
    
    if ([self.tableViewOne respondsToSelector:@selector(setLayoutMargins:)]) {
        [self.tableViewOne setLayoutMargins:UIEdgeInsetsZero];
    }
}