1- (void) Viewdidload2 {3 [Super Viewdidload];4 5 //Upward6Uiswipegesturerecognizer *swipe =[[Uiswipegesturerecognizer alloc] init];7 //set the direction of the swipe8Swipe.direction =Uiswipegesturerecognizerdirectionup;9 [Self.customview addgesturerecognizer:swipe];Ten [Swipe addtarget:self action: @selector (Swipeview)]; One A //downward -Uiswipegesturerecognizer *swipe2 =[[Uiswipegesturerecognizer alloc] init]; - //set the direction of the swipe theSwipe2.direction =Uiswipegesturerecognizerdirectiondown; - [Self.customview addgesturerecognizer:swipe2]; - [swipe2 addtarget:self Action: @selector (SWIPEVIEW2)]; - + //left -Uiswipegesturerecognizer *swipe3 =[[Uiswipegesturerecognizer alloc] init]; + //set the direction of the swipe ASwipe3.direction =Uiswipegesturerecognizerdirectionleft; at [Self.customview addgesturerecognizer:swipe3]; - [Swipe3 addtarget:self Action: @selector (SWIPEVIEW3)]; - - //Right -Uiswipegesturerecognizer *swipe4 =[[Uiswipegesturerecognizer alloc] init]; - //set the direction of the swipe inSwipe4.direction =Uiswipegesturerecognizerdirectionright; - [Self.customview addgesturerecognizer:swipe4]; to [Swipe4 addtarget:self Action: @selector (SWIPEVIEW4)]; + - the * } $- (void) SwipeView4Panax Notoginseng { -NSLog (@"Swipe event Right"); the } + A- (void) SWIPEVIEW3 the { +NSLog (@"Swipe event left"); - } $ $- (void) SwipeView2 - { -NSLog (@"Swipe event under"); the } - Wuyi- (void) Swipeview the { -NSLog (@"Swipe events on"); Wu}
iOS gesture recognition swipe