美文网首页
table的分隔线样式

table的分隔线样式

作者: 小言_0480 | 来源:发表于2020-01-08 16:45 被阅读0次

    调整分界线距离左边SCREEN_W*35/750.0,0  距离右边SCREEN_W*35/750.0,0

    -(void)viewDidLayoutSubviews {

        if([self.table respondsToSelector:@selector(setSeparatorInset:)]){

            [self.table setSeparatorInset:UIEdgeInsetsMake(0,SCREEN_W*35/750.0,0,SCREEN_W*35/750.0)];

        }

        if([self.table respondsToSelector:@selector(setLayoutMargins:)])  {

            [self.table setLayoutMargins:UIEdgeInsetsMake(0,SCREEN_W*35/750.0,0,SCREEN_W*35/750.0)];

        }

    }

    -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPat{

        if([cell respondsToSelector:@selector(setLayoutMargins:)]){

            [cell setLayoutMargins:UIEdgeInsetsMake(0,SCREEN_W*35/750.0,0,SCREEN_W*35/750.0)];

        }

        if([cell respondsToSelector:@selector(setSeparatorInset:)]){

            [cell setSeparatorInset:UIEdgeInsetsMake(0,SCREEN_W*35/750.0,0,SCREEN_W*35/750.0)];

        }

    }

    cell.separatorInset = UIEdgeInsetsMake(0,ViewWidth,0,0);// ViewWidth  去掉某一行的分隔线

    table.separatorStyle = UITableViewCellSeparatorStyleNone;    //分隔线去不去掉

    相关文章

      网友评论

          本文标题:table的分隔线样式

          本文链接:https://www.haomeiwen.com/subject/xjropctx.html