This page is an archive of iMAL's wiki that operated between 2012 and 2022. It documented projects, residencies and workshops mostly taking place at iMAL's Fablab.

Older & newer Fablab projects are now found at fablab.imal.org

How to use the gesture recognizer for iOS

In the workshop page, I've added a class and example to get swipe recognition in iOS using the native GestureRecognizers. It takes ofxGestureRecognizer as a starting point

Here are the instructions

1. put the ofxiOSSwipeRecognizer folder in your addons folder and either
- create an Xcode project with the projectGenerator with the addon checked.
- drag it to the addons folder of an existing project.

2. In testApp.h, create an instance of the swipe recogniser (you should create one instance per direction you want to detect).

ofxiOSSwipeRecognizer leftSwipeRecognizer; 



3. add a method to that will receive the swipe

void onSwipeLeft(ofxiOSSwipeEventArgs & args); 



4. in testApp.cpp call swipeRecognizer.setup on setup passing the direction of the swipe (if you don't pass any it'll use left, which is apple's default)

leftSwipeRecognizer.setup(OFXIOS_SWIPE_DIRECTION_RIGHT);



5. add a listener for the swipeRecognized event

 

ofAddListener(leftSwipeRecognizer.swipeRecognized, this, &testApp::onSwipeLeft);



6. implement the onSwipeLeft method and do cool things with it

void testApp::onSwipeLeft(ofxiOSSwipeEventArgs & args){ .... }

Info

Difficulty: ●○○○○

Contributors:

Last updated: November 2012