Skip to content
Browse files

Fixed a method swizzling error. Resolves #12

- the method order was inverted
- caused problems on iOS 7, since the UIScrollView implementation changed
- added some comments to this section
  • Loading branch information...
1 parent 8190926 commit 8c3c10f43189e82e0dfdfee614b3ae6805a0b877 @matej committed Jun 16, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 MBPullDownController/MBPullDownController.m
View
7 MBPullDownController/MBPullDownController.m
@@ -456,9 +456,10 @@ - (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestu
@implementation UIScrollView (MBPullDownControllerHitTest)
+ (void)_MB_SwizzleHitTestForUIScrollView {
+ // Based on http://www.mikeash.com/pyblog/friday-qa-2010-01-29-method-replacement-for-fun-and-profit.html
Class class = [UIScrollView class];
- SEL originalSelector = @selector(_MB_PullDownControllerHitTest:withEvent:);
- SEL overrideSelector = @selector(hitTest:withEvent:);
+ SEL originalSelector = @selector(hitTest:withEvent:);
+ SEL overrideSelector = @selector(_MB_PullDownControllerHitTest:withEvent:);
Method originalMethod = class_getInstanceMethod(class, originalSelector);
Method overrideMethod = class_getInstanceMethod(class, overrideSelector);
IMP overrideImp = method_getImplementation(overrideMethod);
@@ -473,6 +474,8 @@ + (void)_MB_SwizzleHitTestForUIScrollView {
}
- (UIView *)_MB_PullDownControllerHitTest:(CGPoint)point withEvent:(UIEvent *)event {
+ // Don't capture touches above the scrollView content aria (touch trhough to the view below),
+ // if the scroll view is part of a pull down controller
if (point.y <= 0.f && self.superview.tag == kContainerViewTag) {
return nil;
}

0 comments on commit 8c3c10f

Please sign in to comment.
Something went wrong with that request. Please try again.