I'm trying to write a program using UIBezierPath and touches Methods. I am confused by two touches method:
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
I don't understand when these method are called or how can I call them. At first I thought they both were the same, until I read somewhere that they weren't. Question is: How can I call one of these methods and how are they different from one another?
You shouldn't call these methods. They are called by Cocoa framework for you. You just need to implement them to provide correct (the native one) behaviour o your subclass of
UIResponseror your customUIGestureRecognizersubclass.Please refer to Apple's guide about subclassing
UIResponderfor more details about how you should implement these methods.From Apple's documentation about
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)eventmethod:From Apple's documentation about
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)eventmethod: