I have the mainViewController but I have an small UIView inside that is activated when you tap a MKAnnotationView in the MKMapKit, so I need that UIView to be draggable in any part of the screen.
An example screenshot of my app:

The circle is an example of point, I suppose I can drag for any point of the "small" UIView.
I tried using UITapGestureRecognizer but it didn't worked as my code was not good enough and I could not made it draggable because it's only the tap, not tap and move.
I hope you can help me.
edited after a commend by @borrrden
UIPanGestureRecognizer is suitable. In your handler function check it's state variable.
typedef enum {
UIGestureRecognizerStatePossible,
UIGestureRecognizerStateBegan, // this will be the value on touch
UIGestureRecognizerStateChanged, // ~ on drag
UIGestureRecognizerStateEnded, // ~ on end of touch event
UIGestureRecognizerStateCancelled,
UIGestureRecognizerStateFailed,
UIGestureRecognizerStateRecognized = UIGestureRecognizerStateEnded
} UIGestureRecognizerState;
UIPanGestureRecognizer instead of UITapGestureRecognizer
userInteractionEnabled = YES for your viewFor create draggable and resizable UIView This example (with source code) really useful for you.
And also read This Document and This Document This document is related to UIPanGestureRecognizer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With