Skip to content

Instantly share code, notes, and snippets.

@agustinhaller
Created March 6, 2014 07:07
Show Gist options
  • Select an option

  • Save agustinhaller/9383946 to your computer and use it in GitHub Desktop.

Select an option

Save agustinhaller/9383946 to your computer and use it in GitHub Desktop.
//
// HomeViewController.m
// SlidingPanels
//
// Created by Agus on 05/03/14.
// Copyright (c) 2014 StartAppLabs. All rights reserved.
//
#import "HomeViewController.h"
#import "DynamicTransition.h"
#import "UIViewController+ECSlidingViewController.h"
@interface HomeViewController ()
@property (nonatomic, strong) UIPanGestureRecognizer *dynamicTransitionPanGesture;
@end
@implementation HomeViewController
#pragma mark - UIViewController
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if ([(NSObject *)self.slidingViewController.delegate isKindOfClass:[DynamicTransition class]]) {
DynamicTransition *dynamicTransition = (DynamicTransition *)self.slidingViewController.delegate;
if (!self.dynamicTransitionPanGesture) {
self.dynamicTransitionPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:dynamicTransition action:@selector(handlePanGesture:)];
}
// Trying this code to enable both tapping and swiping
self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning;
// End of code chunk
[self.navigationController.view removeGestureRecognizer:self.slidingViewController.panGesture];
[self.navigationController.view addGestureRecognizer:self.dynamicTransitionPanGesture];
} else {
// Trying this code to enable both tapping and swiping
self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning;
// self.slidingViewController.customAnchoredGestures = @[];
// End of code chunk
[self.navigationController.view removeGestureRecognizer:self.dynamicTransitionPanGesture];
[self.navigationController.view addGestureRecognizer:self.slidingViewController.panGesture];
}
}
#pragma mark - IBActions
- (IBAction)leftMenuButtonTapped:(id)sender {
[self.slidingViewController anchorTopViewToRightAnimated:YES];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment