Drawing CGPathRef in ScrollView using Iphone sdk.

Posted by Ann on Stack Overflow See other posts from Stack Overflow or by Ann
Published on 2010-03-10T16:11:33Z Indexed on 2010/03/13 18:55 UTC
Read the original article Hit count: 491

Hi all.

I want to draw some curve in my scroll view using CGPathRef. I tried to draw this path but i see only the part of my CGPathRef which located at 320x480 pixels. Is it way to do that.

Thank you in advance. Here is my code

path = CGPathCreateMutable();

CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, [[pathArray objectAtIndex:0]CGPointValue].x,[[pathArray         objectAtIndex:0]CGPointValue].y );

for(int i = 1; i < [pathArray count]; ++i)
{
    CGContextAddLineToPoint(ctx, [[pathArray objectAtIndex:i]CGPointValue].x, [[pathArray objectAtIndex:i]CGPointValue].y); 
}
CGContextClosePath(ctx);

CGContextSetRGBFillColor(ctx, 0.5, 0.3, 0.2, 0.5); 
CGContextFillPath(ctx);

And when I scroll my view the line does not change its location. My goal is to move this line during scrolling.

© Stack Overflow or respective owner

Related posts about cocos2d-iphone

Related posts about iphone