Detect Gesture on Xcode 8.0 Swift 3.0 - swift

What is an easy way to detect a swipe gesture in Xcode 8.0 Swift 3.0. I want to implement this into a segue that goes off the screen when a user swipes.
Thanks,

The best way of doing this is to drag a swipe gesture recognizer into the VC. Then at the top of the VC, you can drag the icon of the swipe gesture recognizer to the VC you want to segue to. In your case, you would want to use a custom segue so that you can create a segue to suit your needs. If you want to you can change the direction of the swipe in the right sidebar when you select the gesture.
Hope this helps :-)

Related

What gesture recogniser does Photo app use

What gesture recogniser should I use if I want to the user to swipe between 2 UIView's in the same way they swipe between photos in the Photo app? No the zooming just the transition between 2 photos.
Should I use the swipe or the pan gesture?
I am also using this with the UIPageControl so that when they swipe the page changes and the new view is visible.
The answer is you use no gesture recogniser, instead you have to implement your own dragging method in scroll view delegate methods. Look at Apple's code they have written for this; http://developer.apple.com/library/ios/samplecode/PageControl/PageControl.zip
I think It would be better to use swipe gesture recognizer.I have used same way with UIPagecontrol and its working smoothly.

How to detect horizontal swipe gesture on the custom UIScrollView?

I created custom UIScrollView and add UIImageView.
I want to detect horizontal swipe gesture on the UIScrollView, but I cannot do it.
I cannot find any other references in my case.
I found only following url, but it's not real detecting gesture.
How to recognize swipe gesture in UIScrollView
I've not any zoom effect.
Please help me.
Doesn't one of the UIScrollViewDelegate methods such as [UIScrollViewDelegate scrollViewDidScroll:] work for you? I don't know your specific case, but standard way of detecting swipe action in UIScrollView should be through its delegate.

iOS Touches Began

What I want: Touch a button and a view is added right where the touch is. Without having to lift the finger the touches began/moved automatically begins working on the UIView. So without lifting the finger, I have touched the button and can drag the new view around.
What I don't know how to do:
Stop the touch events on the button and immediately send the touch events to the new view that is directly under the finger.
One option could be to ditch the button and just use the uiview touches to detect when to add the subview you want to let the user drag...
Daniel
As #Daniel suggested ditch the button and just use a UIView, but I believe you may need to have a UIPanGestureRecognizer in place to get your dragging.
You could set a flag when a new UIView is created and then forward any gesture events to that view - only while the user still has their finger down from the initial touch.
After the user has lifted their finger the new view can just deal with gestures by itself by adding a UIPanGestureRecognizer to it.

How to pass a 'tap' to UIButton that is underneath UIView with UISwipeGestureRecognizer?

I have a UIButton underneath a (transparent) UIView. The UIView above has a UISwipeGestureRecognizer added to it, and that is its only purpose - to detect certain swipe gestures. I want all other touches to be ignored by that UIView, and passed to other views (such as my UIButton underneath). Currently, the UIView above seems to be detecting the tap (for example), doing nothing (as it should be), and not letting the UIButton underneath get a chance to respond.
I would prefer not to implement my own swipe recognizer, if possible. Any solutions / advice? I basically just want to know how to tell a UIView to pay attention to only a certain type of added gesture recognizer, and ignore (and thus let through to views behind) all other touches.
Have you set:
mySwipeGesture.cancelsTouchesInView = NO;
to allow the touches to be sent to the view hierarchy as well as the gesture?
Additionally, ensure that the view on top is:
theTransparentView.opaque = NO;
theTransparentView.userInteractionEnabled = YES;
I've had pretty good success attaching gestures to the parent view without needing to create a transparent subview on top for the gesture. Are you sure you need to do that?
I must have just been in a funk yesterday - I woke up with a simple solution today. Add the UISwipeGesture to a view which is a superview to both the UIView and the UIButton. Then, when processing those swipes, figure out where the swipe originated, and whether that point is in the frame of where I used to have the UIView. (As I mentioned, the only reason for the existence of the UIView was to define a target area for these swipe gestures.)
Can't you put your button on top of the view and add gesture recognisers to that button too?
In the end, your UIButton inherits form UIView via UIControl. Therefore there is practically nothing that you could do with a view but not with a button.
In my case, I fixed it by not using a button, but rather a UITapGestureRecognizer. My pan gesture recognizer was added to the background view, and the tap gesture was added to a view above it.

custom slide to reveal toolbar

i want to do a custom toolbar, something like the slide to unlock of android phones. In idle state, the user can see a button of the bottom left of the page. the user would then tap it, drag towards the right. When the user reaches the right end, the toolbar will then 'lock'. Buttons would be located at the toolbar.
I'm think of using a customview and touchmoved functions, but what I don't know how is how to make the view move with the touch, and how to actually lock the bar.
Everytime you move your finger the touchmoved function is called. In the touchmoved function you have to redraw the whole view or just set a new frame for this view. It pretty simple as you already know how to detect touches and react on them.