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

查看:20
本文介绍了新手势 - 从左向右滑动 - 作为旧应用程序中 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 子类.

The answer may have something to do with interactivePopGestureRecognizer which is a UIGestureRecognizer subclass.

推荐答案

如果后退按钮可见,它应该会自动工作.如果您显示的是 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天全站免登陆