Within my project the user is able to draw lines inside the view. However I'd like to have an arrow at the end of each line pointing in the right direction (of the drawer). Is there a way of doing this with CGContext?
Here's a snippit of my code within the touchesmoved method:
I'm thinking of putting a function inside the touchesEnded method but I have no clue what the next thinking steps are.
Hope someone can help me out! Thanks in advance.
Here's a snippit of my code within the touchesmoved method:
Code:
mouseSwiped = YES;
UITouch *touch2 = [touches anyObject];
CGPoint currentPoint = [touch2 locationInView:self.view];
currentPoint.y -= 100;
currentPoint.x -= 0;
UIGraphicsBeginImageContext(drawView.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1.0, 0.0, 0.0, 1.0);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
lastPoint = currentPoint;
I'm thinking of putting a function inside the touchesEnded method but I have no clue what the next thinking steps are.
Hope someone can help me out! Thanks in advance.