绘制Cell的分割线

重写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));

}

你可能感兴趣的:(绘制Cell的分割线)