Quartz 2D绘图引擎,核心对象就是上下文
画线的一个自定义UILable
-(void)drawRect:(CGRect)rect
{
[super drawRect:rect];
// 1.获得上下文
CGContextRef ctx = UIGraphicsGetCurrentContext();
// 2.设置画笔颜色
[self.textColor setStroke];
// 3.设置画笔的起点和终点
CGFloat y = rect.size.width * 0.5;
CGContextMoveToPoint(ctx, 0, y);
CGContextAddLineToPoint(ctx, rect.size.width, y);
// 4.画线
CGContextStrokePath(ctx);
}