Created
March 4, 2011 17:45
-
-
Save sherbondy/855367 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Create a swipe gesture recognizer to recognize right swipes (the default). | |
We're only interested in receiving messages from this recognizer, and the view will take ownership of it, so we don't need to keep a reference to it. | |
*/ | |
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)]; | |
[self.view addGestureRecognizer:recognizer]; | |
[recognizer release]; | |
/* | |
Create a swipe gesture recognizer to recognize left swipes. | |
Keep a reference to the recognizer so that it can be added to and removed from the view in takeLeftSwipeRecognitionEnabledFrom:. | |
Add the recognizer to the view if the segmented control shows that left swipe recognition is allowed. | |
*/ | |
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)]; | |
self.swipeLeftRecognizer = (UISwipeGestureRecognizer *)recognizer; | |
swipeLeftRecognizer.direction = UISwipeGestureRecognizerDirectionLeft; | |
if ([segmentedControl selectedSegmentIndex] == 0) { | |
[self.view addGestureRecognizer:swipeLeftRecognizer]; | |
} | |
self.swipeLeftRecognizer = (UISwipeGestureRecognizer *)recognizer; | |
[recognizer release]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment