美文网首页
自定义tableView的分割线

自定义tableView的分割线

作者: 小小淡定 | 来源:发表于2016-07-25 17:22 被阅读0次

在tableViewcell中重写drawRect方法

CGContextRefcontext =UIGraphicsGetCurrentContext();

CGContextSetFillColorWithColor(context, [UIColorclearColor].CGColor);

CGContextFillRect(context, rect);

//上分割线,

CGContextSetStrokeColorWithColor(context,[UIColorcolorWithWhite:.15f alpha:.2f].CGColor);

CGContextStrokeRect(context,CGRectMake(5, -1, rect.size.width-10,1));

//下分割线

CGContextSetStrokeColorWithColor(context, [UIColorcolorWithWhite:.15f alpha:.2f].CGColor);

CGContextStrokeRect(context,CGRectMake(5, rect.size.height, rect.size.width-10,1));

相关文章

网友评论

      本文标题:自定义tableView的分割线

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