Created
May 11, 2011 11:11
-
-
Save stigi/966295 to your computer and use it in GitHub Desktop.
This file contains 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
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { | |
// never return self. always return the result of [super hitTest..]. | |
// this takes userInteraction state, enabled, alpha values etc. into account | |
UIView *hitResult = [super hitTest:point withEvent:event]; | |
// don't check for links if the event was handled by one of the subviews | |
if (hitResult != self) { | |
return hitResult; | |
} | |
BOOL didHitLink = ([self linkAtPoint:point] != nil); | |
if (self.onlyCatchTouchesOnLinks && !didHitLink) { | |
return nil; // not catch the touch if it didn't hit a link | |
} | |
return hitResult; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment