Swift3 iOS – How to make UITapGestureRecognizer trigger function

From your code you are using swift 3.0 so change your selector syntax like this let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.tapBlurButton(_:))) and Your function like this func tapBlurButton(_ sender: UITapGestureRecognizer) { print(“Please Help!”) } Edit: Not idea that you are using button with tap gesture, instead of that use inbuilt method addTarget for button … Read more

UIPageViewController Gesture recognizers

Here is another solution, which can be added in the viewDidLoad template right after the self.view.gestureRecognizers = self.pageViewController.gestureRecognizers part from the Xcode template. It avoids messing with the guts of the gesture recognizers or dealing with its delegates. It just removes the tap gesture recognizer from the views, leaving only the swipe recognizer. self.view.gestureRecognizers = … Read more

How to get UITouch location from UIGestureRecognizer

You can use the locationInView: method on UIGestureRecognizer. If you pass nil for the view, this method will return the location of the touch in the window. – (void)handleTap:(UITapGestureRecognizer *)tapRecognizer { CGPoint touchPoint = [tapRecognizer locationInView: _tileMap] } There is also a helpful delegate method gestureRecognizer:shouldReceiveTouch:. Just make sure to implement and set your tap … Read more

tap gesture recognizer – which object was tapped?

Define your target selector(highlightLetter:) with argument as UITapGestureRecognizer *letterTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(highlightLetter:)]; Then you can get view by – (void)highlightLetter:(UITapGestureRecognizer*)sender { UIView *view = sender.view; NSLog(@”%d”, view.tag);//By tag, you can find out where you had tapped. }

Detecting Pan Gesture End

Pan gesture end event can be detected by checking its state with UIGestureRecognizerStateEnded. Check with the below code . -(void) panAnim:(UIPanGestureRecognizer*) gestureRecognizer { if(gestureRecognizer.state == UIGestureRecognizerStateEnded) { //All fingers are lifted. } } From Apple documentation A panning gesture is continuous. It begins (UIGestureRecognizerStateBegan) when the minimum number of fingers allowed (minimumNumberOfTouches) has moved enough … Read more

How can I capture which direction is being panned using UIPanGestureRecognizer?

On UIPanGestureRecognizer you can use -velocityInView: to get the velocity of the fingers at the time that gesture was recognised. If you wanted to do one thing on a pan right and one thing on a pan left, for example, you could do something like: – (void)handleGesture:(UIPanGestureRecognizer *)gestureRecognizer { CGPoint velocity = [gestureRecognizer velocityInView:yourView]; if(velocity.x … Read more

How to remove all gesture recognizers from a UIView in Swift

UPDATE FOR iOS 11 In general it is (and has always been) a bad idea to remove all gesture recognizes from a view by looping through its gestureRecognizers array. You should only remove gesture recognizers that you add to the view, by keeping track of those recognizers in your own instance variable. This takes on … Read more

How can I tell a UIGestureRecognizer to cancel an existing touch?

This little trick works for me. @implementation UIGestureRecognizer (Cancel) – (void)cancel { self.enabled = NO; self.enabled = YES; } @end From the UIGestureRecognizer @enabled documentation: Disables a gesture recognizers so it does not receive touches. The default value is YES. If you change this property to NO while a gesture recognizer is currently recognizing a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)