TableView 多余分割线的处理

时间:2023-03-09 01:49:22
TableView 多余分割线的处理

方法一,以下两个方法的实现

- (void)viewDidLoad {

[super viewDidLoad];

self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];

}

- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section{

UITableViewHeaderFooterView *footer = (UITableViewHeaderFooterView *)view;

footer.contentView.backgroundColor = [UIColor colorWithRed:237/255.0 green:241/255.0 blue:250/255.0 alpha:1.0];

}

方法二,

在viewDidLoad中调用下面的方法,传入需要处理的tableView即可

-(void)setExtraCellLineHidden: (UITableView *)tableView

{

UIView *view = [UIView new];

view.backgroundColor = [UIColor clearColor];

[tableView setTableFooterView:view];

}