iOS画图 简单划线

来源:互联网 发布:ios9虚拟定位软件 编辑:程序博客网 时间:2024/05/15 21:05

//

//  SCHView.m

//  quartc2d

//

//  Created by tianshangrenjian on 15/6/26.

//  Copyright © 2015 tianshangrenjian. All rights reserved.

//


#import "SCHView.h"

#import <CoreGraphics/CoreGraphics.h>

@implementation SCHView



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

// An empty implementation adversely affects performance during animation.

- (void)drawRect:(CGRect)rect {

    // Drawing code

    

//    CGContextRef  ctx=UIGraphicsGetCurrentContext();//获取了上下文

//    

//    //画一条线

//    CGContextMoveToPoint(ctx, 10, 10);

//    CGContextAddLineToPoint(ctx, 10, 100);

//    CGContextAddLineToPoint(ctx, 100, 100);

//    CGContextAddLineToPoint(ctx, 100, 10);

//    

//    

//    CGContextClosePath(ctx);

//    

//    CGContextSetLineWidth(ctx, 10);

//    

//    [[UIColor redColor] set];

//    

//    CGContextFillPath(ctx);

    

    

    CGContextRef ctx=UIGraphicsGetCurrentContext();

//    CGContextAddEllipseInRect(ctx, CGRectMake(10, 10, 100, 100));

   CGContextAddArc(ctx, 100, 100, 40,0, M_PI_2, 1);

    

    CGContextStrokePath(ctx);

    

    

}

0 0
原创粉丝点击