Questions tagged [uitapgesturerecognizer]

UITapGestureRecognizer is a concrete subclass of UIGestureRecognizer that looks for single or multiple taps.

For the gesture to be recognized, the specified number of fingers must tap the view a specified number of times.

Although taps are discrete gestures, they are discrete for each state of the gesture recognizer; thus the associated action message is sent when the gesture begins and is sent for each intermediate state until (and including) the ending state of the gesture. Code that handles tap gestures should therefore test for the state of the gesture.

Whole document - UITapGestureRecognizer

1215 questions
16
votes
4 answers

Add UITapGestureRecognizer to UITextView without blocking textView touches

How can I add a UITapGestureRecognizer to a UITextView but still have the touches getting through to the UITextView as normal? Currently as soon as I add a custom gesture to my textView it blocks the tap for UITextView default actions like…
Bernd
  • 11,133
  • 11
  • 65
  • 98
15
votes
1 answer

iOS - UITapGestureRecognizer - Selector with Arguments

In my app I am dynamically adding images to my view at runtime. I can have multiple images on screen at the same time. Each image is loaded from an object. I have added a tapGestureRecongnizer to the image so that the appropriate method is called…
Brian Boyle
  • 2,849
  • 5
  • 27
  • 35
14
votes
1 answer

Can a Tap Gesture Recognizer in IB be used on a UILabel and/or UIImageView

I have an xib with a single UIView containing a bunch of images and labels. If I drag a Tap Gesture Recognizer onto the parent view, it works well, but I need to add code to determine the position of the tap so I can respond properly to the label…
user278859
  • 10,379
  • 12
  • 51
  • 74
14
votes
3 answers

UITapGestureRecognizer issue in iOS 9

I guys, today I've updated my iPhone to iOS 9 and now have problems with a gesture recognizer. This is the error: WARNING: A Gesture recognizer (; target= <(action=onVideoTap:, target=)>>) was setup in a storyboard/xib to be added to more than…
user2529173
  • 1,884
  • 6
  • 30
  • 43
14
votes
5 answers

How to detect tap and double tap at same time using UITapGestureRecognizer?

For example I have a view where I want two different gestures: tap to do action A. double tap to do action B. The problem is with UITapGestureRecognizer I can only set minimum required tap count. The single tap gesture recognizer recognizes a tap…
openfrog
  • 40,201
  • 65
  • 225
  • 373
14
votes
5 answers

shouldReceiveTouch on UITableViewCellContentView

I'm trying to ignore UITapGestureRecognizer taps on a UITableView with the following: - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { if ([touch.view…
Jimmy_m
  • 1,568
  • 20
  • 24
14
votes
3 answers

Detect touch event on UIScrollView AND on UIView's components [which is placed inside UIScrollView]

I have UIViewController on my simple storyboard IPad project which contains UIScrollView which is placed over entire surface (1024 x 768). I have created 3 XIB files which are UIViews which my application loads on start in viewDidLoad and add them…
uerceg
  • 4,637
  • 6
  • 45
  • 63
14
votes
3 answers

How to detect a tap gesture in subviews

Quick question: how do i detect if a tap gesture recognizer is within a subview of the view it is added to? Eg. if i click on an object such as a square that has been added as a subview to a background which a tap gesture recognizer has been added…
Fitzy
  • 1,871
  • 6
  • 23
  • 40
13
votes
3 answers

How to use Gesture Recognizers in IB (iPhone/iPad)?

I have just discovered the Gesture Recognizers in IB and I would like to make use of them. I've tried out the Tap Gesture Recognizer however it doesn't seem to work. Here is what I've done... Dragged and dropped the 'Tap Gesture Recognizer' into my…
13
votes
1 answer

swift uitapgesturerecognizer pass parameters

I have a lot of Buttons created programmatically and that can change anytime. my tap gesture : let apriVideoGesture = UITapGestureRecognizer(target: self, action:…
Alessandro Zago
  • 793
  • 3
  • 12
  • 33
12
votes
2 answers

detecting finger up/down UITapGestureRecognizer

How can I know when the finger is down and when is it up with UITapGestureRecognizer? The documentation says I should only handle UIGestureRecognizerStateEnded as tap so it means there is UIGestureRecognizerStateBegin when finger is down, but all I…
Daniel
  • 30,896
  • 18
  • 85
  • 139
12
votes
2 answers

UITapGestureRecognizer initWithTarget:action: method to take arguments?

I'm using UITapGestureRecognizer because I'm using a UIScrollView that acts as a container for my UILabels. Basically I'm trying to use an action method with arguments so I can e.g. send myLabel.tag value to the action method to know what action to…
Peter Warbo
  • 11,136
  • 14
  • 98
  • 193
12
votes
6 answers

UITapGestureRecognizer unrecognized selector sent to instance

I've searched for solutions to this problem but couldn't find anything that seems to address it in my case. I'm getting the above exception from a UITapGestureRecognizer. Here's the simplified code: import UIKit; class ViewController :…
BadmintonCat
  • 9,416
  • 14
  • 78
  • 129
12
votes
1 answer

How can I detect taps on a particular part (substring) of a UILabel?

I am new to iOS development. I dont know whether this questions has been asked already or not, I tried searching for the solution on stackoverflow but didn't get any results. Question : I have a UILabel called myLabel with the text: "Click here to…
user2758267
12
votes
5 answers

hitTest:WithEvent and Subviews

I have 2 views , but i want to make 1 view (virtually) bigger. if I place my tapGesture on v1, the tap gesture works with a bigger hit area but if I place my tapGesture on v2 it doesn't work ( actually it doesn't recognizes the tapGesture at all,…
Andy Jacobs
  • 15,187
  • 13
  • 60
  • 91
1 2
3
80 81