You can do the following:
1. connect your arc to the path,
_path = CGPathCreateMutable();
CGPathAddArc(_path, NULL, e.x, e.y, Distance/2, M_PI + angle1, angle1, aClock);
CGContextAddPath(context, _path);
CGContextStrokePath(context);
2.Presence when touched Began: withEvent:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSSet *allTouches = [event allTouches];
UITouch *touch = [allTouches anyObject];
CGPoint point = [touch locationInView:[touch view]];
if (CGPathContainsPoint(_path, NULL, point, NO)) {
NSLog(@"point:(%f, %f), Touch arc.", point.x, point.y);
}
else {
NSLog(@"point:(%f, %f), Touch other.", point.x, point.y);
}
}
You will see "Touch arc". log when touching the arc.
source
share