1,分割线左对齐
啥也不说了,直接上代码
if ([_MainTab respondsToSelector:@selector(setSeparatorInset:)]) {
[_MainTab setSeparatorInset:UIEdgeInsetsZero];
}
if ([_MainTab respondsToSelector:@selector(setLayoutMargins:)]) {
[_MainTab setLayoutMargins:UIEdgeInsetsZero];
}
_MainTab.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
_MainTab.separatorColor = XHRGBA(204, 204, 204, 1);
_MainTab.tableFooterView = [[UIView alloc] init];
[self setExtraCellLineHidden:_MainTab];
- (void)setExtraCellLineHidden: (UITableView *)sender{
UIView * view = [[UIView alloc] init];
view.backgroundColor = [UIColor clearColor];
[sender setTableFooterView:view];
[sender setTableHeaderView:view];
}
代理方法里面还需要添加
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
2,分割线左右缩进
只要在上面的代码中修改这个位置就可以了
[ListView setSeparatorInset:UIEdgeInsetsMake(0, 15*Father_View_Width, 0, 15*Father_View_Width)];