//隐藏多余的分割线
- (void)setExtraCellLineHidden:(UITableView *)tableView
{
UIView *view = [[UIViewalloc]init];
view.backgroundColor = [UIColorclearColor];
[tableView setTableFooterView:view];
}
然后在tableview创建之后,调用此方法,传入需要设置的tableview就可以了。
//自绘分割线
- (void)drawRect:(CGRect)rect
{
CGContextRef context =UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context,MAINVIEWBGCOLOR.CGColor);//填充色
CGContextFillRect(context, rect);
CGContextSetStrokeColorWithColor(context,TIMINGLISTEXTRACELLLINE.CGColor);//线的颜色
CGContextStrokeRect(context,CGRectMake(AutoWHGetWidth(130), rect.size.height -1, rect.size.width,1));//线的frame
}
self.mainTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
在tableview创建之后,设置tableview的separatorStyle属性即可