I have a pan gesture that I have added on my app's root view controller on the 1st level to let the user swipe anywhere to go to the previous level in the navigation stack (the gesture is not on the 0 level to prevent going into a black hole :) ). This has worked and still works perfectly fine on iOS versions prior to 7.
When I try to swipe back using iOS 7, I get these messages in the console: [11050:a0b] nested pop animation can result in corrupted navigation bar [11050:a0b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
At this point, the app hasn't crashed.
Then when I try to swipe back one more time to the previous level, it crashes. I'm just trying to figure out why this bug has risen in iOS 7, and how I can fix it. Any help is duly and greatly appreciated!
Here is my code:
RootViewController.m:
- (void)viewDidLoad
{
[super viewDidLoad];
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(pop:)];
pan.delegate = self;
[self.view addGestureRecognizer:pan];
}
- (void)pop:(UIPanGestureRecognizer*)pan
{
if (pan.state == UIGestureRecognizerStateBegan || pan.state == UIGestureRecognizerStateChanged)
{
CGPoint vel = [pan velocityInView:self.view];
if (vel.x > 1000)
{
[self.navigationController popViewControllerAnimated:YES];
}
}
}