iOS tableViewCell去掉组头组尾上面的分割线

- (void)addSubview:(UIView *)view{
    if ([view isKindOfClass:NSClassFromString(@"_UITableViewCellSeparatorView")]) {
        return;
    }
    [super addSubview:view];
}

如果是自定义的tableviewcell,那么在内部重写addSubview方法即可。

如果是系统的cell,则需要在- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath方法内进行多余分割线的遍历清除,但这样会出现一个首次加载无法清除掉的bug,建议需要清除组头组尾分割线时,使用自定义的cell使用。

你可能感兴趣的:(iOS tableViewCell去掉组头组尾上面的分割线)