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

iOS5 Stable App Crashing in iOS4.3 Simulator

i am getting an NSInvalidArgumentException with reason: -[UITapGestureRecognizer initWithCoder:]: unrecognized selector sent to instance my understanding was that UITapGestureRecognizers were supported in ios4.x? is it possible to load a different…
9
votes
1 answer

Handling Multiple GestureRecognizers

I've run into an issue understanding UIGestureRecognizers. My goal right now is to have a set of GestureRecognizers to do different tasks, for example: override func viewDidLoad() { mainScene = GameScene(size: self.view.bounds.size) main =…
9
votes
3 answers

How to check if tap happened in a specific place

I am trying to check if a tap is happening in a specific region on the screen. I've set up a TapGestureRecognizer this is the code I have right now: func handleTap(tap: UITapGestureRecognizer) { var point = tap.locationInView(self.view) …
Omer
  • 221
  • 3
  • 13
9
votes
2 answers

iOS: Adding UITapGestureRecognizer to container view intercepts UICollectionView's didSelectItemAtIndexPath method

I added a UITapGestureRecognizer to my main Content View in my ViewController to dismiss my keyboard when the content view is tapped. The problem is that I have a UICollectionView inside my content view, and setting the UITapGestureRecognizer…
The Nomad
  • 7,155
  • 14
  • 65
  • 100
9
votes
3 answers

UITapGestureRecogniser in GMSMapView

I am creating an app using swift. In one of my ViewController, I have a GMSMapView that I create programatically. I want user to have the capability triggering an action when clicking on the map. What I have done : import UIKit class…
soling
  • 303
  • 1
  • 3
  • 11
9
votes
1 answer

What is a UITapAndAHalfRecognizer?

I notice that when I cycle through the gesture recognizers of a UITextView and output the description of each to the console, one of the recognizers that seemed utterly curious was the UITapAndAHalfRecognizer. I know about the others such as…
8
votes
1 answer

Tap Gesture Recognizer Interfering with Clear Button

I have a UITextField with the clear button enabled. I also have some code that dismisses the keyboard when the user taps anywhere else on the screen: let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action:…
user2397282
  • 3,798
  • 15
  • 48
  • 94
8
votes
2 answers

tvOS - catch MENU button presses during push-view-controller transition

I have a UIViewController in my tvOS app which will only appear for a few seconds, and needs totally customizable MENU button handling. I create it like so: - (void)viewDidLoad { [super viewDidLoad]; // Add a tap gesture recognizer to…
StilesCrisis
  • 15,972
  • 4
  • 39
  • 62
8
votes
4 answers

Make a UIView draggable with the finger

I have the mainViewController but I have an small UIView inside that is activated when you tap a MKAnnotationView in the MKMapKit, so I need that UIView to be draggable in any part of the screen. An example screenshot of my app: The circle is an…
Alejandro L.
  • 1,066
  • 5
  • 17
  • 38
7
votes
2 answers

iphone - TapGesture on UIWebView conflicts with the link clicking

I have a UIWebView loaded html string with url links inside. if I click the url links, an internal home-made browser will launch to open that link. I added a UITapGestureRecognizer to the UIWebView so if the user taps anywhere on the UIWebView, the…
Jackson Tale
  • 25,428
  • 34
  • 149
  • 271
7
votes
5 answers

Issue with a UITapGestureRecognizer

I have a main viewController, it is called WelcomeViewController. I have a UIView subclass and that has some view related stuff in it. I want to add a UITapGestureRecognizer to that subclass. I only want the gesture recognizer to acknowledge taps…
Andrew
  • 3,874
  • 5
  • 39
  • 67
7
votes
5 answers

Difference between UITapGestureRecognizer and addTarget

Can anyone clarify the difference between these 2 ways of triggering a function when tapping a view? 1) myView.addTarget(self, action: #selector(myFunctionToTrigger(_:)), forControlEvents: UIControlEvents.TouchUpInside) 2) let tapGesture =…
Daniele B
  • 19,801
  • 29
  • 115
  • 173
7
votes
2 answers

touchesBegan with delay

I have a subclass of UIView, and added the touchesBegan and touchesEnd methods... In touchesBegan, I set the backgroundColor from white to green by using self.backgroundColor = [UIColor greenColor] ... in the touchesEnd I reset the color to white.…
Maurice Raguse
  • 4,437
  • 2
  • 29
  • 46
7
votes
3 answers

UITapGestureRecognizer on SKNode: Converting Coordinates from UIView to SKNode

I have a UITapGestureRecognizer and a UIPanGestureRecognizer on a UIView with a SKScene on it. The pan gesture recogniser moves a SKNode left to right, and I want the Tap gesture recogniser to detect a child of the SKNode that pans. Panning works…
glenstorey
  • 5,134
  • 5
  • 39
  • 71
7
votes
3 answers

UITapGestureRecognizer inexplicably stops recognizing tap gestures

As simply put as possible, a UITapGestureRecognizer that I have assigned to an UIImageView will inevitably and inexplicably cease firing the method it is directed towards. It's even stranger because sometimes it ceases to recognize the gesture after…
esreli
  • 4,993
  • 2
  • 26
  • 40