CoreGraphic 基本使用
2019-04-10 本文已影响0人
d5cbd4f07363
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);
}