UIView is a subclass of UIResponder. That way, you can override the end end / started methods in your custom class, which inherits from UIView. Then you must add a delegate to this class and define a protocol for it. In methods
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
or any interactions you need, just send the appropriate message to the delegate of the object, also passing this object. For instance.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[delegate touchesBeganInView: self withEvent: event];
}
source
share