绘制Cell的分割线

2016-06-02  本文已影响50人  地选之猿

重写Cell中的drawRect

- (void)drawRect:(CGRect)rect {

CGContextRefcontext =UIGraphicsGetCurrentContext();

CGContextSetFillColorWithColor(context, [UIColorclearColor].CGColor);

CGContextFillRect(context, rect);

//绘制分割线,其实就是在cell内画一条线

CGContextSetStrokeColorWithColor(context, [UIColorgrayColor].CGColor);

//设置所画线的frame

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

}

上一篇 下一篇

猜你喜欢

热点阅读