I have a class that derives from UIControl in which I monitor the touchesBegan/Moved/Ended/Cancelled events. Within those events I call the same events on both super and next responder like so:
[self.nextResponder touchesEnded:touches withEvent:event];
[self sendActionsForControlEvents:UIControlEventTouchUpInside];
[super touchesEnded:touches withEvent:event];
I have a parent control that owns a table view. The cells in the table view each contain one of my custom controls. In order to respond to a click I assign a selector to the control when I am creating it and adding it to the table view cell like so:
[myControl addTarget:self action:@selector(myControlTap:withEvent:)forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:myControl];
The parent control's selector looks like this:
- (void)myControlTap:(id)sender withEvent:(UIEvent *)event{
//UIEvent is always null!
}
Can someone tell me why UIEvent is always nil? If I use an instance of UIButton instead of my custom UIControl then UIEvent is not nil. Furthermore, if I don't call sendActionsForControlEvents in my control then the parent control will never receive any event notifications.