From 694d4614a7b8f61c739d409bf68dda75403d5b4a Mon Sep 17 00:00:00 2001 From: Ash Furrow Date: Fri, 3 May 2013 14:23:55 -0400 Subject: [PATCH] Fixes Issue #28 --- Upcoming/TLRootViewController.m | 37 ++------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/Upcoming/TLRootViewController.m b/Upcoming/TLRootViewController.m index c2da1f8..e365fd2 100644 --- a/Upcoming/TLRootViewController.m +++ b/Upcoming/TLRootViewController.m @@ -31,7 +31,6 @@ @interface TLRootViewController () @property (nonatomic, strong) UIPanGestureRecognizer *panHeaderUpGestureRecognizer; @property (nonatomic, strong) UITapGestureRecognizer *tapGestureRecognizer; @property (nonatomic, strong) UIPanGestureRecognizer *panFooterUpGestureRecognizer; -@property (nonatomic, strong) UIPanGestureRecognizer *panFooterDownGestureRecognizer; // Two subjects used to receive translations from the gesture recognizers @property (nonatomic, strong) RACSubject *headerPanSubject; @@ -55,7 +54,7 @@ @implementation TLRootViewController static const CGFloat kMaximumHeaderTranslationThreshold = 320.0f; // We have to use a #define here to get the compiler to expand this macro -#define kMaximumFooterTranslationThreshold (-CGRectGetMidY(self.view.bounds) - CGRectGetHeight(self.footerViewController.view.bounds) / 2.0f) +#define kMaximumFooterTranslationThreshold (-CGRectGetMidY(self.view.bounds)/4.0f - CGRectGetHeight(self.footerViewController.view.bounds) / 2.0f) - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { @@ -306,7 +305,6 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil RAC(self.panHeaderDownGestureRecognizer.enabled) = canOpenMenuSignal; RAC(self.panFooterUpGestureRecognizer.enabled) = canOpenMenuSignal; RAC(self.dayListViewController.view.userInteractionEnabled) = canOpenMenuSignal; - RAC(self.panFooterDownGestureRecognizer.enabled) = self.footerFinishedTransitionSubject; RAC(self.panHeaderUpGestureRecognizer.enabled) = self.headerFinishedTransitionSubject; RAC(self.tapGestureRecognizer.enabled) = self.headerFinishedTransitionSubject; @@ -440,7 +438,7 @@ -(void)viewDidLoad else if (state == UIGestureRecognizerStateEnded) { // Determine the direction the finger is moving and ensure if it was moving down, that it exceeds the minimum threshold for opening the menu. - BOOL movingUp = [recognizer velocityInView:self.view].y < 0; + BOOL movingUp = NO;//[recognizer velocityInView:self.view].y < 0; // Animate the change [UIView animateWithDuration:0.25f animations:^{ @@ -460,37 +458,6 @@ -(void)viewDidLoad self.panFooterUpGestureRecognizer.delegate = self; [self.view addGestureRecognizer:self.panFooterUpGestureRecognizer]; [self.dayListViewController.touchDown requireGestureRecognizerToFail:self.panFooterUpGestureRecognizer]; - - self.panFooterDownGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithHandler:^(UIGestureRecognizer *sender, UIGestureRecognizerState state, CGPoint location) { - UIPanGestureRecognizer *recognizer = (UIPanGestureRecognizer *)sender; - - CGPoint translation = [recognizer translationInView:self.view]; - if (state == UIGestureRecognizerStateChanged) - { - [self.footerPanSubject sendNext:@(kMaximumFooterTranslationThreshold + translation.y)]; - } - else if (state == UIGestureRecognizerStateEnded) - { - // Determine the direction the finger is moving - BOOL movingDown = ([recognizer velocityInView:self.view].y > 0); - - // Animate the change - [UIView animateWithDuration:0.25f animations:^{ - if (movingDown) - { - [self.footerPanSubject sendNext:@(CGRectGetHeight(self.view.bounds) - TLUpcomingEventViewControllerHiddenHeight)]; - } - else - { - [self.footerPanSubject sendNext:@(kMaximumFooterTranslationThreshold)]; - } - } completion:^(BOOL finished) { - [self.footerFinishedTransitionSubject sendNext:@(!movingDown)]; - }]; - } - }]; - self.panFooterDownGestureRecognizer.delegate = self; - [self.view addGestureRecognizer:self.panFooterDownGestureRecognizer]; } -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch