UIgestures recognizer is an abstract base class for concrete gesture – recognizer classes.
Gestures- recognizer object (or, simply, a gesture recognizer) decouples the logic for recognizing a gesture and acting on that recognition.
When one of these objects recognizes a common gesture or in some classes, a change in the gesture, it sends an action message to each designated target object.
Inclined to build a profession as IOS Developer? Then here is the blog post on iPhone Development Certification Training.
The concrete sub classes are of the following:
A: UITapGestureRecognizer
B: UIRotationGestureRecognizer
C: UISwpieGestureRecognizer
D: UIPanGestureRecognizer
E: UILongpressGestureRecognizer.
-(void) viewDidload {
UITapGestureRecognizer *recognizer = [[ UITapGestureRecognizer alloc] initWithTarget: self Action:@ selector (gesture action)]; [ self view addGestureRecognizer: recognizer]; [ recognizer release];
UIlongPressGestureRecognizer * LongPress = [[ UILongPressGestureRecognizer alloc] initWithTarget: self Action : @ Selector ( gestureAction)]; [ self view addGestureRecognize : long press]; [ long press release];
UISwipeGestureRecognizer * swipe1= [[UISwipeGestureRecognizer alloc] initWithTarget : self Action : @ Selector ( gesture Action left]; [Swipe1 setDirection : UISwipeGestureRecognizer. Direction left] [ img view addGestureRecognizer : Swipe1]; [ Swipe1 release];
UISwipeGestureRecognizer *Swipe r = [ UISwipe GestureRecognizer alloc] initWith target : self action:@ selector (gestureActionRight)]; [ Swipe setDirection : UISwipeGesturRecognizerDirectionRight]; [ img view addGestureRecognizer: swipe]; [ swipe r release];
UISwipeGestureRecognizer *swipe u = [[ UI SwipeGestureRecognizer alloc] init withTarget : self action : @ Selector (gesture Action up)]; [SwipeU setDirection: UISwipeGestureRecognizerDirectionup]; [ imgview addGestureRecognizer : SwipeU]; [ swipe u release];
UISwipeGestureRecognizer *swipe D= [[ UISwipeGestureRecognizer alloc] initWith target: self action :@ Selector (gesture ActionDown)]; [ SwipeD setDirection : UISwipeGestureRecognizerDirectionDown]; [ img view addGestureRecognizer: swipe]; [ swipeD release]; -(void) gestureAction Left { NSLog ( @ “ view Swiped to Left”); } -( void) gestureActionRight { NSLog ( @ “ view Swiped to Right”); } -(void) gestureActionup { NSLog (@ “view Swiped to up”); } -(void) gestureActionDowns { NSLog (@ “view Swiped to Down”); }
Frequently Asked iPhone Interview Questions & Answers
Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!
Name | Dates | |
---|---|---|
IOS Development Training | Mar 25 to Apr 09 | |
IOS Development Training | Mar 28 to Apr 12 | |
IOS Development Training | Apr 01 to Apr 16 | |
IOS Development Training | Apr 04 to Apr 19 |
I am Ruchitha, working as a content writer for MindMajix technologies. My writings focus on the latest technical software, tutorials, and innovations. I am also into research about AI and Neuromarketing. I am a media post-graduate from BCU – Birmingham, UK. Before, my writings focused on business articles on digital marketing and social media. You can connect with me on LinkedIn.
1 /15
Copyright © 2013 - 2023 MindMajix Technologies