IOS uitableview中cell的分割线设置距离,并且去掉cell的边框,要不然多了一条细线这个主要是针对自定义cell的
judgeCell.backgroundView=[[UIViewalloc] init];
judgeCell.backgroundColor=[UIColorclearColor];
在每个cell的高的返回的时候要注意要返回整数值,要不然也可能会出现,在项目这个小问题太坑人啦
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView==_tablex ) {
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsMake(0,50, 0, 0) ];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsMake(0,50, 0, 0)];
}
}
if (tableView== _tablex1) {
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
}
- (void)viewDidLayoutSubviews
{
if ([_tablexrespondsToSelector:@selector(setSeparatorInset:)]) {
[_tablexsetSeparatorInset:UIEdgeInsetsMake(0,50, 0, 0)];
}
if ([_tablexrespondsToSelector:@selector(setLayoutMargins:)]) {
[_tablexsetLayoutMargins:UIEdgeInsetsMake(0,50, 0, 0)];
}
if ([_tablex1respondsToSelector:@selector(setSeparatorInset:)]) {
[_tablex1setSeparatorInset:UIEdgeInsetsZero];
}
if ([_tablex1respondsToSelector:@selector(setLayoutMargins:)]) {
[_tablex1setLayoutMargins:UIEdgeInsetsZero];
}
}