I am using qlpreviewcontroller to show images but single tap is not working on it.
How can I add single tap gesture on it. It will work for double tap to zoom in and zoom out images.
Can any body help me to add single tap gesture.
Sadly, you can not add gestures to QLPreviewController. I has fairly limited functionality and is not meant to be modified much.
Related
I'm trying to make a card game app (with swift 4) like a Solitaire Card Game.
So I have to use Drag and Drop to each Card UIView.
But I think there are two ways to use for dragging.
Which one is better between UIPanGesture and UIDragInteraction/UIDropInteraction?
Furthermore, I'm not sure about what panning means.
2. what is difference between dragging and panning?
(From Apple site: UIDragInteraction & UIPanGestureRecognizer),
UIDragInteraction
An interaction to enable dragging of items from a view, employing a delegate to provide drag items and to respond to calls from the drag session.
UIPanGestureRecognizer
A concrete subclass of UIGestureRecognizer that looks for panning (dragging) gestures.
Here, Pan & Drag gesture is almost same.
Some of differences which I got from searching are as follow..
UIDragInteraction works from iOS 11.0+ & UIPanGestureRecognizer works from iOS 3.2+, so if you want to run your application in older version devices then you should use UIPanGestureRecognizer
UIPanGestureRecognizer works on the whole screen & gives you the CGPoints as response of touch where UIDragInteraction works on the particular object you want to drag & drop & gives you direct the view object.
UIPanGestureRecognizer can work with multiple touches & handle those where UIDragInteraction doesn't allow you to handle multiple touch.
Hope this helps.
Thanks
So if any of you have used the tumblr mobile app recently, you'll notice that the reblog function has a tap and hold capability. Essentially when you tap and hold the reblog button, more buttons pop up around it so the user can just drag their finger over one of the new buttons and release to select it. I've been digging around and no one seems to have an answer to this specific question.I've always seen this as a very elegant way to have a sub menu and would like to implement it into my own apps. For ios btw.
Add gesture recognizer to a view. write a method to create buttons when long press gesture is done on the view.
I am trying to make a game in SWIFT (SpriteKit) where the user can pick between a large amount of characters to play as during the game. The 'characters' would be in what looks like a horizontal picker view. It is similar to the app "Ball King's" player chooser that looks like this:
and
I do not know where to start and any help would be great! Thank you!
Just set up a UISwipeGestureRecognizer in your view. When a swipe is detected, get the direction of the swipe and either display the next or previous sprite with an animation. If you haven't used gesture recognizers documentation is here. Another option is to simply detect swipes generically using touchesBegan, touchesMoved, etc.
I was trying show a bunch of images, one at once. User could swipe left or right to navigate, just like photo library.
What I did is, for example I have 6 images, create a scroll view to hold those 6 images, and using pan gesture to move it.
Am I doing right? Or is there another neat solution?
Thanks
EDIT:
I'm asking am I doing right by using gesture?
More specific, should I use UIScrollView to do this or I should use something else?
Update:
I finally figure out a way to do. Use UIPanGestureRecognizer and check the speed. if the speed is fast enough, then treat like swipe gesture. Will post code later.
UIScrollView has a default gesture and does not need a new one.
I am making an iPad app and I have 3 small UIWebViews on the view. I have realized that if there is an HTML input field and I tap on it, Keyboard appears and covers one of the webviews. I can move up the web view but how can I detect which webviews' input field is tapped?
I would say use TapRecognizer active on the whole view. Using tap recognizer, find the location where it is tapped.
Now based on location I believe you can tell which webview is tapped.
Based on which webview is tapped, you can shift view upside.
Hope this will do the trick.