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
7
votes
2 answers

pass parameter to UITapGestureRecognizer

i have created dynamic UIimage view and and UITapGestureRecognizer to the view its look like this UIImageView *image = [[UIImageView alloc ] initWithFrame:CGRectMake(x, 0, 200, 150)]; NSString *ImageURL = [str objectForKey:@"imageLink"]; …
Kamal Upasena
  • 1,329
  • 4
  • 13
  • 38
7
votes
2 answers

MvvmCross: GestureRecognized binding to ViewModel action

There is such ability to bind buttons actions directly like this: var set = this.CreateBindingSet<... set.Bind(button).To(x => x.Go); but what's about UITapGestureRecognizer, for instance. How should I bind it (it's tap action) in such elegant…
Agat
  • 4,577
  • 2
  • 34
  • 62
7
votes
1 answer

Implement singleTap and doubleTap in Objective-C

I add singTap and doubleTap to a view like the code below: -(void)awakeFromNib{ [self setUserInteractionEnabled:YES]; // UITapGestureRecognizer *doubleTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self…
Jack
  • 81
  • 8
6
votes
5 answers

Add a tap gesture recognizer to PDFView in iOS 13

My code works in iOS 12. But after upgrading to iOS 13, it does not work. let pinPointRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.pinPoint(sender:))) pinPointRecognizer.numberOfTapsRequired =…
ysong4
  • 131
  • 1
  • 9
6
votes
4 answers

swift UITapGestureRecognizer not working on view

I had to create a new thread bcoz it's driving me crazy and all the other answers online are exactly the same. I have done this countless of times but I cannot see what I am missing for the life of me. I am using a "test" view controller just to get…
user7804097
  • 308
  • 1
  • 3
  • 17
6
votes
1 answer

UITapGestureRecognizer crashes on multiple taps

I am adding UIImageView into UIScrollView programmatically and adding a tap gesture on imageView. It recognizes the tap event exactly 4 times and on fourth time it crashes without any clear error message. This is in the controller named…
umair151
  • 553
  • 5
  • 21
6
votes
1 answer

sending a parameter argument to function through UITapGestureRecognizer selector

I am making an app with a variable amount of views all with a TapGestureRecognizer. When the view is pressed, i currently am doing this func addView(headline: String) { // ... let theHeadline = headline let tapRecognizer =…
Norse
  • 628
  • 8
  • 26
6
votes
1 answer

Tap gesture not working for me

I am getting started with this Apple tutorial. So I created a Tap Gesture by drag and drop on Image View, Then I control-drag into my UIViewControler and the Event (Action) is created successfully. But my problem is that it is not firing the event.…
Imran Sh
  • 1,623
  • 4
  • 27
  • 50
6
votes
4 answers

Getting UITableViewCell from UITapGestureRecognizer

I have a UITableView with multiple sections and in my cellForRowAtIndexPath method I add a UITapGestureRecognizer to the cell's imageView (each cell has a small image). I have been successful in accessing that image (in order to change it) by…
iOSBeginner
  • 363
  • 4
  • 17
6
votes
5 answers

Add a tap gesture to a part of a UILabel

I have a NSAttributedString like so: NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"testing it out @clickhere"]; NSInteger length = str.length; [str addAttribute:NSForegroundColorAttributeName value:[UIColor…
cdub
  • 24,555
  • 57
  • 174
  • 303
6
votes
4 answers

iOS - Add Tap Gesture to UITextField

I have problem with add a Tap Gesture to my UITextField. Below code: @IBAction func hanldeTap(recognizer: UITapGestureRecognizer) { println("works") } This action is associated with Tap Gesture Recognizer. In my TextField I have defined…
LakaLe_
  • 454
  • 1
  • 6
  • 15
6
votes
1 answer

UITapGestureRecognizer doesn't fire after rotate

I've got a TabBarController which has two tabs. In each tab I've got UICollectionView and UITapGestureRecognizer which fires every time when I tap on collectionView. Everything works fine after the app is started. But if I rotate to landscape…
6
votes
2 answers

Add double tap to UICollectionView; require single tap to fail

With a similar problem to this question, I am trying to add a double tap gesture recognizer to my UICollectionView instance. I need to prevent the default single tap from calling the UICollectionViewDelegate method…
6
votes
2 answers

iOS - Multiple Tap gesture recognizers

In my application, i've to detect single, double and triple taps. So, I'm using UITapGestureRecognizer. I'm using the following code: UITapGestureRecognizer *oneTap = [[UITapGestureRecognizer alloc] initWithTarget:self…
Satyam
  • 15,493
  • 31
  • 131
  • 244
6
votes
1 answer

How to call didSelectRowAtIndexPath method with UITapGestureRecognizer?

I've searched for hours on Google and Stackoverflow, tried them but no luck. I have a UITableView tblDepartment and a UISearchBar studentSearch above it. I add a UITapGestureRecognizer to dismiss the keyboard from studentSearch textbox when users…
Phuong Nguyen
  • 147
  • 1
  • 5
  • 13