新手势 - 从左向右滑动 - 作为旧应用中UINavigationController中“后退”按钮的快捷方式 [英] New gesture - Swipe left to right - as shortcut for Back button in UINavigationController in old app

查看:123
本文介绍了新手势 - 从左向右滑动 - 作为旧应用中UINavigationController中“后退”按钮的快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 7采用新手势,在屏幕上从左向右滑动,作为UINavigationController中后退按钮的快捷方式。

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

我的应用似乎不是免费接受这种行为。我需要做什么才能使这个手势可用于我的iOS应用程序(在iOS 5.1及更高版本的Xcode 4.6.3中构建)?

My app does not seem to be picking up this behavior for free. What do I need to do to make this gesture available to my iOS app (built for iOS 5.1 and later in Xcode 4.6.3)?

这是一篇有视频的文章, 从用户的角度来看,你想知道的iOS 7中的新手势

Here's an article with video, The new gesture in iOS 7 you want to know about, from a user's perspective.

答案可能与 interactivePopGestureRecognizer 这是 UIGestureRecognizer 子类。

推荐答案

它如果后退按钮可见,则应自动工作。如果您正在显示leftBarButtonItem而不是后退按钮,则默认情况下不会显示该手势。此外,如果您使用的是UINavigationBar而不是UINavigationController,则不会看到此功能。

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.

如果您使用的是UINavigationController且视图控制器的导航项包含leftBarButtonItem,通过将代理附加到导航控制器的 interactivePopGestureRecognizer

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.

编辑:我没有注意到您正在构建针对SDK 5.1。这是iOS 7 SDK中的一项新功能,因此我认为您需要针对iOS 7 SDK构建Xcode 5才能使用新功能。

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.

这篇关于新手势 - 从左向右滑动 - 作为旧应用中UINavigationController中“后退”按钮的快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆