关于CoreGraphics绘图

    UIGraphicsBeginImageContext(CGSizeMake(200, 200)); //创建位图上下文
    CGContextRef ctx = UIGraphicsGetCurrentContext();  //返回当前上下文
    CGContextBeginPath(ctx);//创建新路径
    CGRect rect = CGRectMake(0, 0, 80, 40);
//    CGContextAddArc(ctx, 100, 100, 100, 0, 4*M_PI, 1);//使用狐制度创建狐
//    CGContextAddEllipseInRect(ctx,rect);//绘制椭圆
    CGContextAddRect(ctx, rect);//绘制矩形
    CGContextSetRGBFillColor(ctx, 1, 0, 0, 0.5);//设置颜色
    CGContextFillPath(ctx);//自动关闭路径,并通过填充对路径进行喷漆.

你可能感兴趣的:(关于CoreGraphics绘图)