ios-response up or down swipe gestureCategory: iphone development 2012-03-17 14:42 25489 people read reviews (8) favorite reports Iosup
-(void) viewdidload{
Uiswipegesturerecognizer *recognizer;
recognizer = [[Uiswipegesturerecognizer alloc]initwithtarget:self Action: @selector (Handleswipefrom:)];
[Recognizer Setdirection: (uiswipegesturerecognizerdirectionright)];
[[Self view] addgesturerecognizer:recognizer];
[Recognizer release];
recognizer = [[Uiswipegesturerecognizer alloc]initwithtarget:self Action: @selector (Handleswipefrom:)];
[Recognizer Setdirection: (Uiswipegesturerecognizerdirectionleft)];
[[Self view] addgesturerecognizer:recognizer];
[Recognizer release];
recognizer = [[Uiswipegesturerecognizer alloc]initwithtarget:self Action: @selector (Handleswipefrom:)];
[Recognizer Setdirection: (Uiswipegesturerecognizerdirectionup)];
[[Self view] addgesturerecognizer:recognizer];
[Recognizer release];
Uiswipegesturerecognizer *recognizer;
recognizer = [[Uiswipegesturerecognizer alloc]initwithtarget:self Action: @selector (Handleswipefrom:)];
[Recognizer Setdirection: (Uiswipegesturerecognizerdirectiondown)];
[[Self view] addgesturerecognizer:recognizer];
[Recognizer release];
}
-(void) Handleswipefrom: (Uiswipegesturerecognizer *) recognizer{
if (Recognizer.direction==uiswipegesturerecognizerdirectiondown) {
NSLog (@ "swipe down");
Execute the program
}
if (recognizer.direction==uiswipegesturerecognizerdirectionup) {
NSLog (@ "swipe up");
Execute the program
}
if (recognizer.direction==uiswipegesturerecognizerdirectionleft) {
NSLog (@ "swipe left");
Execute the program
}
if (recognizer.direction==uiswipegesturerecognizerdirectionright) {
NSLog (@ "swipe right");
Execute the program
}
}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
======================================
ios-response up or down swipe gesture