Created
January 15, 2014 08:54
-
-
Save manmal/8432920 to your computer and use it in GitHub Desktop.
Forwards hit testing on a UITableView to certain views which are behind the tableview (siblings of UITableView). Quite hacky :/ If you know a better way, please tweet @manuelmaly
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
@interface MMTableViewWithParallaxHeader : UITableView | |
@property (strong, nonatomic) NSArray *forwardTouchesOnTransparentCellToViews; | |
@end | |
@implementation MMTableViewWithParallaxHeader | |
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { | |
if ([self pointInside:point withEvent:event]) { | |
for (UITableViewCell *cell in self.visibleCells) { | |
if ([cell isKindOfClass:MMTransparentCell.class] && [cell pointInside:[self convertPoint:point toView:cell] withEvent:nil]) { | |
for (UIView *forwardTouchesView in _forwardTouchesOnTransparentCellToViews) { | |
if ([forwardTouchesView hitTest:[self convertPoint:point toView:forwardTouchesView] withEvent:event]) | |
return nil; | |
} | |
} | |
} | |
} | |
return [super hitTest:point withEvent:event]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment