0

In iOS 7 Apple add new default navigation behavior. You can swipe from left border of the screen to go back on navigation stack.
But in my test project, this behavior seems doesn't work. I've check it for many times and tried the following blog
http://keighl.com/post/ios7-interactive-pop-gesture-custom-back-button/

UPDATE

Actually it works, but I have to swipe from the very left of the screen, so I made a mistake, can we optimize it?

2
  • Try to set delegate property self.navigationController.interactivePopGestureRecognizer.delegate = self; Commented Jan 9, 2015 at 9:44
  • @Brain89 I've set self.interactivePopGestureRecognizer.delegate = self; in the NavigationController's viewDidload method already. Commented Jan 9, 2015 at 9:49

3 Answers 3

2

Add this code in your Appdelegate.m file and pop gesture will work in your whole application. Also add the UIGestureRecognizerDelegate in your Appdelegate.h file.

self.navigationController.interactivePopGestureRecognizer.delegate = self; self.navigationController.interactivePopGestureRecognizer.enabled = YES; 

Swipe from the very left end of the screen, only then the pop gesture will work

Sign up to request clarification or add additional context in comments.

3 Comments

I've add those code in the NavigationViewController(it's the initial viewController, In fact, You can't access the navigationController in Appdelegate.m). But it doesn't work.
Tks a lot, It works...The problem is I haven't swipe from the very left. Any way to optimize it?
@bazysong It is default behaviour of the interactivePopGestureRecognizer. So we cannot optimize it.
0

You haven't write any code in your project and for navigation behaviour you must add UINavigationController to your project. please put proper link or proper code here.

1 Comment

Sorry that the url is wrong. But the problem is fixed now, tks a lot.
0

Were you using the simulator? its harder to do there than on real devices.

I wouldn't recommend changing how this gesture works, it should be uniform between apps to be useful.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.