简体   繁体   中英

How to create custom back swipe gesture in UINavigationController on iOS 7

I found that some of the apps on iOS7 contain a custom back swipe gesture to pop out current view controller from navigation controller. The custom gesture is different from the official one (interactivePopGestureRecognizer).

The custom gesture can be activated by swiping from left to right in any position of the screen but not on the edge of the screen only.

eg: Instagram (Option View swipe back to Profile View)

自定义向后滑动

Any ideas on creating this gesture?

The keyword for a simple method is screenshot .

When you want to swipe back to UIViewControllerA from UIViewControllerB , you can take a screenshot(named UIImageA ) for UIViewControllerA . Then you can archived desired effect by the UIImageA and the UIViewControllerB .

You will need to create a custom UIViewController transition.

Take a look at these examples for reference:

http://www.teehanlax.com/blog/custom-uiviewcontroller-transitions/ http://www.thinkandbuild.it/interactive-transitions/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM