Created
July 1, 2014 20:32
-
-
Save elizaaverywilson/ce38770cff5d14dfe770 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIResponder*)responderOf:(UIView*)view forPoint:(CGPoint)point { | |
DDLogDebug(@"View:%@ subviews: %@", view, view.subviews); | |
if (!view || view.hidden || !CGRectContainsPoint([self.rootView convertRect:view.frame fromView:view.superview], point)) { | |
return nil; | |
} | |
if ([self object:view isKindOfAClass: [self allowedResponderClasses]] && view.userInteractionEnabled && ((UIControl*)view).enabled) { | |
DDLogDebug(@"View confirmed: %@", view); | |
return view; | |
} else { | |
for (NSUInteger i = 0; i < view.subviews.count; i++) { | |
UIView *subview = (UIView*)view.subviews[i]; | |
UIResponder *responder = [self responderOf: subview forPoint:point]; | |
DDLogDebug(@"Responder confirmed: %@", responder); | |
return responder; | |
} | |
} | |
DDLogDebug(@"Returning nil for responder."); | |
return nil; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment