diff --git a/TWTSideMenuViewController-Sample/TWTMainViewController.m b/TWTSideMenuViewController-Sample/TWTMainViewController.m index 0270a2c..17079fe 100644 --- a/TWTSideMenuViewController-Sample/TWTMainViewController.m +++ b/TWTSideMenuViewController-Sample/TWTMainViewController.m @@ -28,6 +28,15 @@ - (void)viewDidLoad self.navigationItem.leftBarButtonItem = openItem; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kTableViewCellIdentifier]; + + UISwipeGestureRecognizer *swipeRightGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipedRight:)]; + swipeRightGesture.direction = UISwipeGestureRecognizerDirectionRight; + [self.view addGestureRecognizer:swipeRightGesture]; +} + +-(void)swipedRight:(UISwipeGestureRecognizer *)sender +{ + [self openButtonPressed]; } - (void)openButtonPressed diff --git a/TWTSideMenuViewController/TWTSideMenuViewController.m b/TWTSideMenuViewController/TWTSideMenuViewController.m index 0e4fa96..48e473a 100644 --- a/TWTSideMenuViewController/TWTSideMenuViewController.m +++ b/TWTSideMenuViewController/TWTSideMenuViewController.m @@ -91,6 +91,16 @@ - (void)viewDidLoad [self.menuViewController didMoveToParentViewController:self]; [self updateMenuViewWithTransform:[self closeTransformForMenuView]]; + + UISwipeGestureRecognizer *swipeLeftGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipedLeft:)]; + swipeLeftGesture.direction = UISwipeGestureRecognizerDirectionLeft; + [self.view addGestureRecognizer:swipeLeftGesture]; +} + +-(void)swipedLeft:(UISwipeGestureRecognizer *)sender +{ + if (self.open) + [self toggleMenuAnimated:YES completion: nil]; } - (BOOL)shouldAutorotate