自定义cell时,绘制分割线的一个方法

来源:互联网 发布:php性能分析工具 编辑:程序博客网 时间:2024/05/22 04:55


技术需要交流,好东西需要分享。


-(void)drawRect:(CGRect)rect{

    [super drawRect:rect];

    

    CGContextRef context = UIGraphicsGetCurrentContext();

    

    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);

    CGContextFillRect(context, rect);

    

    CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:0xE2/255.0f green:0xE2/255.0f blue:0xE2/255.0f alpha:1].CGColor);

    CGContextStrokeRect(context, CGRectMake(0, rect.size.height - 0.5, rect.size.width, 0.5));

    

}

0 0