Skip to content

Instantly share code, notes, and snippets.

@ksm
Created November 23, 2014 12:57
Show Gist options
  • Save ksm/da1dd59f38babe929c44 to your computer and use it in GitHub Desktop.
Save ksm/da1dd59f38babe929c44 to your computer and use it in GitHub Desktop.
Allow a view to capture touches while it is animating (e.g. for interactive animations and transitions)
// Presentation Layer Hit Test
// Source: WWDC2014 Session 236
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
CGPoint pointInSuperview = [self convertPoint:point toView:self.superview];
CGPoint presentationLayerPoint = [self.layer.presentationLayer convertPoint:pointInSuperview fromLayer:self.superview.layer];
return [super hitTest:presentationLayerPoint withEvent:event];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment