I need to use view swipe gesture down, up, left and then right. But on swift UISwipeGestureRecognizer has predeterminate right direction. And I don't know how make this for use other directions.
Asked
Active
Viewed 311 times
0
Opal
- 76,740
- 25
- 177
- 200
Krishnaveni
- 34
- 2
-
http://stackoverflow.com/questions/24215117/how-to-recognize-swipe-in-all-4-directions you can check this page. It worked on me. – slytrkmn Nov 30 '16 at 17:22
1 Answers
0
You can achieve different swipe direction using code and Storyboard as well.
Using Code
var swipeLeft = UISwipeGestureRecognizer() swipeLeft.direction = UISwipeGestureRecognizerDirection.Left //Use following Directions as you need //UISwipeGestureRecognizerDirection.Right //UISwipeGestureRecognizerDirection.Up //UISwipeGestureRecognizerDirection.LeftUsing Storyboard:
Select the gesture and in Attribute Inspector select the direction. see the screen shot.
Note: You will need 4 different gesture recognisers for 4 directions
Vivek Molkar
- 3,842
- 1
- 35
- 44