如何在Cocoa中实现两指滑动手势来回前进? [英] How to implement the two-finger swipe gesture in Cocoa to go back and forward?

查看:20
本文介绍了如何在Cocoa中实现两指滑动手势来回前进?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您用两根手指滑动妙控鼠标(或三指放在妙控板上).

Several applications like Safari and the Finder go back and forward when you swipe with two fingers on your Magic Mouse (or with three fingers on your Magic Trackpad).

我将如何在我的 Cocoa 应用程序中实现这一点?有哪些课程可供选择?

How would I implement this in my Cocoa application? What classes are available?

推荐答案

三指滑动是最简单的,因为 NSResponder 已经为您完成了工作:

Three finger swipes are easiest, because NSResponder already does the work for you:

- (void)swipeWithEvent:(NSEvent *)event;

如果你想支持两个手指滑动(我认为技术上不能归类为滑动,而是滚动手势),你必须手动处理触摸 - 见 http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/HandlingTouchEvents/HandlingTouchEvents.html#//apple_ref/doc/uid/10000060i-CH13-SW10

If you want to support two finger swipes (which I don't think technically can be classified as swipes, but rather scroll gestures), you'll have to manually process the touches- see http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/HandlingTouchEvents/HandlingTouchEvents.html#//apple_ref/doc/uid/10000060i-CH13-SW10

这篇关于如何在Cocoa中实现两指滑动手势来回前进?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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