How to implement two-finger gestures in Cocoa to go back and forth?

Several applications, such as Safari and Finder, come back and forth when you swipe two fingers on your Magic Mouse (or three fingers on your Magic Trackpad).

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

+5
source share
2 answers

The simplest three fingers are the easiest because NSResponder is already doing your job:

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

( , swipes, ), - . http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/HandlingTouchEvents/HandlingTouchEvents.html#//apple_ref/doc/uid/10000060i-CH13-SW10

+5

, NSView, , (, NSScrollView), - scrollWheel: (NSEvent *) . , [event deltaX] [deltaY].

+4

All Articles