开发者

Draw curved arrow between two points using Quartz Core in iPhone

I want to draw a curved line with arrow between two p开发者_运维知识库oints using the Quartz Core framework in an iPhone Application. How to do that or any what classes are available to do that ?


You can change the co-ordinates as you want

 - (void)drawRect:(CGRect)rect {

    //DRAW CURVE
    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSetLineWidth(context, 2.0);

    CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);

    CGContextMoveToPoint(context, 100, 100);
    CGContextAddArcToPoint(context, 100,200, 300,200, 100);
    CGContextStrokePath(context);

    //DRAW LINE
    CGContextSetLineWidth(context, 2.0);

    CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();

    CGFloat components[] = {0.0, 0.0, 1.0, 1.0};

    CGColorRef color = CGColorCreate(colorspace, components);

    CGContextSetStrokeColorWithColor(context, color);

    CGContextMoveToPoint(context, 0, 0);
    CGContextAddLineToPoint(context, 300, 400);

    CGContextStrokePath(context);
    CGColorSpaceRelease(colorspace);
    CGColorRelease(color);

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜