IOS gesture Swipe Event bindings

Source: Internet
Author: User

Uigesturerecognizer Gesture Response base class
-UITapGestureRecognizer//TAP gesture recognizer, can be clicked once, or can be recognized multiple times
-uipinchgesturerecognizer//pinch gesture recognizer for zooming in and out of views
-Uirotationgesturerecognizer//rotary gesture Recognizer
-uiswipegesturerecognizer//swipe gesture recognizer, swipe up, down, left, and right
-uipangesturerecognizer//drag gesture recognizer
-uilongpressgesturerecognizer//long press gesture recognizer, common long press to jump out an interface for editing

Here is a demonstration of

Uiswipegesturerecognizer//swipe up or down

PS: Parameter description: Self set proxy class, @selector set event response,

Then to set which view gesture to respond to

This is set to

Self.gameview

/* *  bind gesture event, up or down  **/-  (void) bindaction {     uiswipegesturerecognizer *recognizer;    recognizer = [[ Uiswipegesturerecognizer alloc] initwithtarget:self action: @selector (handleswiperight)];     [recognizer setdirection: (uiswipegesturerecognizerdirectionright)];     [self.gameView addGestureRecognizer:recognizer];         Recognizer = [[uiswipegesturerecognizer alloc] initwithtarget:self action: @selector ( Handleswipeleft)];    [recognizer setdirection: (uiswipegesturerecognizerdirectionleft )];    [self.gameview addgesturerecognizer:recognizer];        recognizer = [[uiswipegesturerecognizer alloc] initwithtarget:self action : @selector (Handleswipetop)];    [recoGnizer setdirection: (uiswipegesturerecognizerdirectionup)];    [self.gameview  addgesturerecognizer:recognizer];        recognizer = [[ Uiswipegesturerecognizer alloc] initwithtarget:self action: @selector (handleswipebottom)];     [recognizer setdirection: (Uiswipegesturerecognizerdirectiondown)];     [self.gameview addgesturerecognizer:recognizer];}




IOS gesture Swipe Event bindings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.