I am creating an app, in which when I am swiping my finger on screen, that time I am drawing line using code.
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(),3.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0.0, 0.5, 0.6, 1.0);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), startPoint.x, startPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), endPoint.x, endPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
}
And I am also moving arrow at the same time at that line using code....
-(void)moveBallConstantly
{
[UIView animateWithDuration:0.01f animations: ^{
[appDel.ballImageView setCenter:CGPointMake(appDel.ballImageView.center.x + (x/increamentFraction), appDel.ballImageView.center.y + (y/increamentFraction))];
}];
}
Its just little part of function. I am able to move arrow constantly, but for better smooth movement of arrow, I am calling this function repeatedly with timer .01.
As I am doing both the processing together so its creating problem sometimes. Sometimes arrow movement method gets delayed and sometimes Line drwing method gets delayed.