I used the code given below is to draw a line using CGContext...i could draw the line using cg context...but i want to know how to rotate the line drawn by cg context....i hope anyone can give me the best solution with the exact code.....
Code:
- (void)drawRect:(CGRect)rect
{
// Draw a line
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
// Draw them with a 2.0 stroke width so they are a bit more visible.
CGContextSetLineWidth(context, 2.0);
CGContextMoveToPoint(context, 0,20); //start at this point
CGContextAddLineToPoint(context, 320, 480); //draw to this point
// and now draw the Path!
CGContextStrokePath(context);
CGContextClosePath(context);
CGAffineTransform rotation = CGAffineTransformMakeRotation(6.283185307);
CGContextConcatCTM(context, rotation);
}
Last edited by a moderator: