The UIBezierPath class has an instance method called - (BOOL)containsPoint: Using this method and 2 UIBezierPath s you can check if your object is moving along the path.
+---------+ |xxxxxxxxx| |x+-----+x| |x| |x| |x| |x| |x| |x| |x+-----+x| |xxxxxxxxx| +---------+
The trick here is to make 1 path slightly smaller than the first (maybe 2 pixels), ensuring that both paths have a common center. The path / route your object should move will be the difference in the areas of the bezier paths that you get from the call - (BOOL)containsPoint:
If your object is contained in a large UIBezierPath , but not in a small one, then you know that you are on the right track.
source share