UITableView的cell可以通过多种方式定义,其中少见的是用CG绘制,方法如下:- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
CGContextFillRect(context, rect);

//上分割线
CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
CGContextStrokeRect(context, CGRectMake(30, -0.5, rect.size.width - 60, 1));
}
//下分割线
CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
CGContextStrokeRect(context, CGRectMake(30, rect.size.height - 0.5, rect.size.width - 60, 1));
}