I am using swift gesture in my app But these swipes are just up - down - right and left - I want some thing more !!! I want to have swipe gesture from one point to another point with x and y for example from one point in the middle of the screen to another point near right with special X and Y and the most important thing is that how can I use this code to all devices?! because when I am using for example iPhone 4s it is more different than iPad pro screen
Asked
Active
Viewed 108 times
1 Answers
0
One way you could do this is by adding a transparent view to the area of the screen that you want a gesture to be recognized in. So, if we consider your case, you could add a view that is presented over the center of its superview to some point near the right of its superview. Set the isOpaque property to false. Add a swipe gesture to this view with the target being the superview, and the action being the method of the superview that you want to execute when the swipe gesture is recognized on the newly added transparent subview.

hvasam
- 304
- 4
- 12
-
I didn't understand completely - can you write some codes for example? – Saeed Rahmatolahi Mar 07 '17 at 05:43
-
I have AVPlayer and want to add swipe gesture to that But not simple swipe gesture – Saeed Rahmatolahi Mar 07 '17 at 06:19
-
Sorry, saw this a bit late. Do you still need an example? – hvasam Mar 13 '17 at 17:31
-
no problem I have AVPlayer and added some button in it with subview I want to add Gesture in it with some thing like subview and I Please write some codes here – Saeed Rahmatolahi Mar 14 '17 at 08:10
-
I have Added as you said to the another view and bring that view to front But didn't Worked Again – Saeed Rahmatolahi May 27 '17 at 18:23
-
https://stackoverflow.com/questions/44288116/how-can-i-add-swipe-gesture-to-avplayer-in-swift-3?noredirect=1#comment75583657_44288116 – Saeed Rahmatolahi May 31 '17 at 15:18