绘制图形-移动,旋转,阴影,渐变

// Only override drawRect: if you perform custom drawing.

// An empty implementation adversely affects performance during animation.

- (void)drawRect:(CGRect)rect {

    UIBezierPath *path = [UIBezierPath bezierPath];

    //画图的起点坐标

    [path moveToPoint:CGPointMake(50, 50)];

    //依次连接各个坐标

    [path addLineToPoint:CGPointMake(50, 100)];

    [path addLineToPoint:CGPointMake(100, 100)];

    [path addLineToPoint:CGPointMake(100, 50)];

    //闭合

    [path closePath];

    //上下文

    CGContextRef context = UIGraphicsGetCurrentContext();

    //保存上下文状态

    CGContextSaveGState(context);

原文地址:https://www.cnblogs.com/wzjhoutai/p/6817023.html