Gustaf Rosenblad
Gustaf Rosenblad

Reputation: 1922

Slide back in UINavigationController like in Facebook for iOS

I saw the Facebook app update for iOS (6.1.1) and it has a rely nice slide back function. For now I have a UISlideGestureRecognizer that when is called a do a [self.navigationController popViewController:YES];. But how can I make it with a UIPanGestureRecognizer like in the Facebook app? Should I build my own UINavigationController?

I do not know more than this (yet):

backView1 = [[self.navCon.viewControllers objectAtIndex:self.navCon.viewControllers.count - 2] view];
backView2 = [[self.navCon.viewControllers objectAtIndex:self.navCon.viewControllers.count - 1] view];

Please help in advance!

UPDATE:

Screenshot: enter image description here

Upvotes: 1

Views: 1742

Answers (3)

Subhash Khimani
Subhash Khimani

Reputation: 437

To add effect of Slide back in UINavigationController add the following code line and add gesture recognizer delegate

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = YES;
        self.navigationController.interactivePopGestureRecognizer.delegate = self;
    }
}


- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
    return YES;
}

Upvotes: 0

Marco Sero
Marco Sero

Reputation: 460

I've created a subclass of UINavigationController to do that. Here you go: https://github.com/MarcoSero/MSSlideNavigationController

Upvotes: 3

Augie
Augie

Reputation: 1341

if you're talking about slide out menu you can partially 'swipe', see this for several examples.

SplitView like Facebook app on iPhone

Upvotes: 0

Related Questions