自定义tableView的分割线

在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的分割线)