How to rotate a circle clockwise and anticlockwise?
<p>Basically this is my code which draws a circle with 4 different colored and equal sized quadrants.What I want to do is to rotate this circle clockwise and anticlockwise i.e. clockwise' when i touch circle and drag it a bit in clockwise direction and vice versa.
I have made circle through core graphics.One more thing is that the circle must rotate initially at high speed and will slow down gradually until it stops.Any help in this regard will be greatly appreciated.
Please reply ASAP.</p>

<pre><code>- (void)drawRect:(CGRect)rect { 

    CGContextRef context = UIGraphicsGetCurrentContext();
 // CGRect mainSquare = self.bounds/2; 

    CGRect mainSquare = CGRectMake(X_SPACE, Y_SPACE, 220, 200);

    CGContextSaveGState(context);

    // Create circle path and clip

    CGContextAddEllipseInRect(context, mainSquare);
    CGContextClip(context);

    // Define rects
    NSLog(@"helll  %f",mainSquare.size.width);
     CGRect topLeft = CGRectMake(mainSquare.origin.x, mainSquare.origin.y, (mainSquare.size.width / 2) , (mainSquare.size.height / 2) );
     CGRect topRight = CGRectMake((mainSquare.size.width / 2) + X_SPACE, mainSquare.origin.y, mainSquare.size.width / 2, (mainSquare.size.height / 2) );
     CGRect bottomLeft = CGRectMake(mainSquare.origin.x, (mainSquare.size.height / 2) + Y_SPACE, mainSquare.size.width / 2, (mainSquare.size.height / 2) );
     CGRect bottomRight = CGRectMake((mainSquare.size.width / 2) + X_SPACE, (mainSquare.size.height / 2) + Y_SPACE, mainSquare.size.width / 2, mainSquare.size.height / 2);  
    // Define colors
    CGColorRef topLeftColor = [[UIColor redColor] CGColor];
    CGColorRef topRightColor = [[UIColor blueColor] CGColor];
    CGColorRef bottomLeftColor = [[UIColor greenColor] CGColor];
    CGColorRef bottomRightColor = [[UIColor yellowColor] CGColor];  
    // Fill rects with colors
    CGContextSetFillColorWithColor(context, topLeftColor);
    CGContextFillRect(context, topLeft);    
    CGContextSetFillColorWithColor(context, topRightColor);
    CGContextFillRect(context, topRight);   
    CGContextSetFillColorWithColor(context, bottomLeftColor);
    CGContextFillRect(context, bottomLeft); 
    CGContextSetFillColorWithColor(context, bottomRightColor);
    CGContextFillRect(context, bottomRight);
    CGContextRestoreGState(context);

}
</code></pre>
