Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 188.8.131.52 release ready!
Updated 24 September 2021
Swipe Gesture Recognizer is a very common and important feature. it is used when we drag a finger towards a direction (left, right, top, down).
An example of the swipe gesture exists in the photos gallery app where we use swipe gestures to slide from one photo to another
We can add swipe gestures to any view. For example, we have a custom view over your app and we want to remove it if the user swipe from left to right. For that, we need to add a gesture recognizer to that view.
Now, we are going to apply Swipe gestures on UIView.
Now, Add UISwipeGestureRecognizer and create an object for swipe Gesture
Note:- A swipe gesture recognizer object monitor and perform an action only one direction, so if you want to support swiping towards two or more directions then you have to create two and more recognizer objects respectively
Note:- set UISwipeGestureRecognizer in viewDidLoad function.
Let’s Create a method that is performing an action when the UISwipeGestureRecognizer perform
Let’s run the project and check the swipe gesture, try to swipe left, right, top, down.
Swipe gestures allow us to move a view to any of the four directions:- left, right, top, down. But not in a diagonal way.
I hope this blog helps you to understand the basics of UISwipeGestureRecognizer. it is very easy and simple to use and make your application interactive
Lastly, Please share your thoughts with us in the comment area.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.