//
//
//
// Created by Arun Thiru on 25/02/14.
//
#import <UIKit/UIKit.h>
@interface NewNavigationController : UINavigationController
@end
@interface BEWLoginNavigationController ()<UIGestureRecognizerDelegate, UINavigationControllerDelegate>
@property (nonatomic, retain) UISwipeGestureRecognizer *swipeGesture;
@end
@implementation NewNavigationController
#pragma mark - View cycles
- (void)viewDidLoad
{
[super viewDidLoad];
__weak NewNavigationController *weakSelf = self;
self.delegate = weakSelf;
self.swipeGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(gestureFired:)];
[self.view addGestureRecognizer:self.swipeGesture];
}
#pragma mark - gesture method
-(void)gestureFired:(UISwipeGestureRecognizer *)gesture
{
if (gesture.direction == UISwipeGestureRecognizerDirectionRight)
{
[self popViewControllerAnimated:YES];
}
}
#pragma mark - UINavigation Controller delegate
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
self.swipeGesture.enabled = NO;
[super pushViewController:viewController animated:animated];
}
#pragma mark UINavigationControllerDelegate
- (void)navigationController:(UINavigationController *)navigationController
didShowViewController:(UIViewController *)viewController
animated:(BOOL)animate
{
if(![viewController isKindOfClass:[YourViewController class]])
{
self.swipeGesture.enabled = YES;
}
}
@end
Translate
Wednesday, 5 March 2014
Swipe to pop view controller for both IOS 6 and IOS 7
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment