When a gesture event is received by our view, we can take whatever action we would like to handle the event. We decide which gestures we want to handle and what we want them to do.
In Xcode, click on the file named
BTSFingerView.m
in the project navigator and add the following method to handle arotateWithEvent:
gesture:/** ** (void)rotateWithEvent:(NSEvent *)event ** ** Invoked when two fingers make a rotating ** gesture on the trackpad ** ** Input: event - the gesture event ** ** Output: none */ - (void)rotateWithEvent:(NSEvent *)event { // If the pen is not down if (NSOffState == m_penDownCheckbox.state) { // Rotate the super view // By the amount of rotation in the // event [self.superview setFrameCenterRotation: [self.superview frameCenterRotation] + [event rotation]]; } }