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

iOS TableViewCell的自定义分割线

作者: 欲速则不达 | 来源:发表于2016-07-30 14:08 被阅读60次

使用方法:
在自定义cell中加入以下方法即可

  • (void)drawRect:(CGRect)rect
    {
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
    CGContextFillRect(context, rect);
    // 分割线,
    CGContextSetStrokeColorWithColor(context, [UIColor lightGrayColor].CGColor);
    CGContextStrokeRect(context, CGRectMake(0, rect.size.height - 0.1, rect.size.width, 0.1));
    }

相关文章

网友评论

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

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