Last active
August 29, 2015 14:07
-
-
Save clooth/b6e9290fb944d1f5a3f6 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
// Splitter view recognizer should only begin if we're truly touching something inside the splitter view | |
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer | |
{ | |
if (gestureRecognizer == _splitterPanRecognizer) { | |
CGPoint location = [gestureRecognizer locationInView:self.view]; | |
BOOL didHitView = NO; | |
NSArray *hitTestViews = @[_splitterView]; | |
hitTestViews = [hitTestViews arrayByAddingObjectsFromArray:_splitterView.subviews]; | |
for (UIView *hitTestView in hitTestViews) { | |
CGPoint locationInView = [hitTestView convertPoint:location fromView:self.view]; | |
if (CGRectContainsPoint(hitTestView.bounds, locationInView)) { | |
didHitView = YES; | |
} | |
} | |
return didHitView; | |
} | |
return NO; | |
} | |
// Make other gesture recognizers fail if we have a hit on our splitter view | |
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer | |
{ | |
if ([self gestureRecognizerShouldBegin:gestureRecognizer] == YES) { | |
return YES; | |
} | |
return NO; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment