iOS TableViewCell的自定义分割线
2016-07-30 本文已影响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));
}