New gesture - Swipe left to right - as shortcut for Back button in UINavigationController in old app

后端 未结 2 647
甜味超标
甜味超标 2021-01-06 00:07

iOS 7 sports a new gesture, swiping left to right across the screen as a shortcut for the Back button in a UINavigationController.

My app does not seem to be picking

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-06 00:35

    It should work automatically if the back button is visible. If you are displaying a leftBarButtonItem instead of the back button, the gesture will not be present by default. Also, if you are using a UINavigationBar but not a UINavigationController, you won't see this functionality.

    If you are using a UINavigationController and your view controller's navigation item contains a leftBarButtonItem, it's still possible to add functionality for the swipe left to right gesture of the navigation controller, by attaching a delegate to the navigation controller's interactivePopGestureRecognizer.

    EDIT: I didn't notice that you're building against SDK 5.1. This is a new feature in the iOS 7 SDK, so I believe you'll need to build with Xcode 5 against the iOS 7 SDK in order to make use of the new feature.

提交回复
热议问题