Reputation: 1430
I´m using a UISwipeGestureRecognizer on an UIButton which is
connected to an IBAction handleSwipe:
- (IBAction) handleSwipe:(UISwipeGestureRecognizer*) swipeRecognizer {
NSLog(@"handleSwipe: %i",[swipeRecognizer direction]);
}
Unfortunately only right swipes are recognized. I don´t see any settings to limit the swipes to left or right. Any ideas?
Upvotes: 2
Views: 815
Reputation: 670
The setting you mentioned is the direction
property, introduced on iOS 3.2. To recognise left and right swipe just do
swipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionLeft | UISwipeGestureRecognizerDirectionRight;
where swipeGestureRecognizer
is your instance of UISwipeGestureRecognizer
.
Upvotes: 1