- (void)updateTopViewHorizontalCenterWithRecognizer:(UIPanGestureRecognizer *)recognizer { CGFloat translationX = [recognizer translationInView:self.slidingViewController.view].x; CGFloat velocityX = [recognizer velocityInView:self.slidingViewController.view].x; NSLog(@"PANNING 0 GOING ON!!!"); // if (recognizer) { // [[UIApplication sharedApplication] setStatusBarHidden:YES]; // } switch (recognizer.state) { case UIGestureRecognizerStateBegan: { BOOL isMovingRight = velocityX > 0; if (self.slidingViewController.currentTopViewPosition == ECSlidingViewControllerTopViewPositionCentered && isMovingRight) { [self.slidingViewController anchorTopViewToRightAnimated:YES]; NSLog(@"PANNING 1 GOING ON!!!"); } else if (self.slidingViewController.currentTopViewPosition == ECSlidingViewControllerTopViewPositionCentered && !isMovingRight) { [self.slidingViewController anchorTopViewToLeftAnimated:YES]; NSLog(@"PANNING 2 GOING ON!!!"); } else if (self.slidingViewController.currentTopViewPosition == ECSlidingViewControllerTopViewPositionAnchoredLeft) { [self.slidingViewController resetTopViewAnimated:YES]; NSLog(@"PANNING 3 GOING ON!!!"); } else if (self.slidingViewController.currentTopViewPosition == ECSlidingViewControllerTopViewPositionAnchoredRight) { [self.slidingViewController resetTopViewAnimated:YES]; NSLog(@"PANNING 4 GOING ON!!!"); } break; } case UIGestureRecognizerStateChanged: { if (!self.positiveLeftToRight) translationX = translationX * -1.0; CGFloat percentComplete = (translationX / self.fullWidth); if (percentComplete < 0) percentComplete = 0; [self updateInteractiveTransition:percentComplete]; NSLog(@"PANNING 5 GOING ON!!!"); break; } case UIGestureRecognizerStateEnded: NSLog(@"PANNING 6 GOING ON!!!"); case UIGestureRecognizerStateCancelled: { BOOL isPanningRight = velocityX > 0; if (self.coordinatorInteractionEnded) self.coordinatorInteractionEnded((id)self.slidingViewController); if (isPanningRight && self.positiveLeftToRight) { [self finishInteractiveTransition]; } else if (isPanningRight && !self.positiveLeftToRight) { [self cancelInteractiveTransition]; } else if (!isPanningRight && self.positiveLeftToRight) { [self cancelInteractiveTransition]; } else if (!isPanningRight && !self.positiveLeftToRight) { [self finishInteractiveTransition]; } NSLog(@"PANNING 7 GOING ON!!!"); break; } default: break; } }