- 满行显示分割线
- 隐藏指定行的分割线
- 左右分割线两端距离
1.满行显示
// 满行
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
if([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]){
[cell setPreservesSuperviewLayoutMargins:NO];
}
2.隐藏指定行
隐藏前需先按1设置满行显示
// 隐藏分割线
if (indexPath.row == 1) {
cell.separatorInset = UIEdgeInsetsMake(0, cell.bounds.size.width, 0, 0 );
}
3.左右两端距离
// 左右边距
cell.separatorInset = UIEdgeInsetsMake(0, 左距离, 0, 右距离 );
~ ~ ~ ~ ~ ~ end ~ ~ ~ ~ ~ ~ by Roy
--------*愿您有所收获 *