1.绘制线条
- (void)drawRect:(CGRect)rect
{
CGContextRefcontext =UIGraphicsGetCurrentContext();
//设置上下文使用的颜色
[[UIColor yellowColor] set];
CGContextSetLineWidth(context,4.0);
CGContextSetShadowWithColor(context,CGSizeMake(10.0f,10.0f),20.0f, [UIColorredColor].CGColor);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextMoveToPoint(context,50.0,200.0);
CGContextAddLineToPoint(context,50.0,400.0);
CGContextAddLineToPoint(context,250.0,400.0);
CGContextClosePath(context);//开始绘制CGContextStrokePath(context);
}
网友评论