去掉tableView的外边框

要实现的效果是:tableView分割线1个像素,距离self.view左右两边各为32个像素。spa

 设置了_tableView.separatorInset,实现分割线距离左右间隔32像素 (没有效果。。)3d

// 当设置以下的时候,分割线1像素,可是外边框也存在。orm

 _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;it

 cell.layer.borderWidth = 1;io

 cell.layer.borderColor = Color_BorderGray.CGColor;table

 cell.selectionStyle = UITableViewCellSelectionStyleNone;select

// 如下是我用的方法遍历

去掉上面的代码, 让tableview 的效果呈现没有边框及分割线的样式。而后遍历一个像素为1的label。。
方法

 for (NSInteger i; i < _titleArray.count; i ++) {im

        UILabel *lineLbl = [[UILabel alloc] initWithFrame:CGRectMake(32, 66 * (i + 1), SCREEN_WIDTH- 64, 1)];

        lineLbl.backgroundColor = Color_BorderGray;

        [cell.contentView addSubview:lineLbl];

    }

    

效果就达到了。。。

相关文章
相关标签/搜索