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

Adding Multiple UITapGestureRecognizers to single view (Cocos2d)

I am adding the following code in the onEnter method. doubleTapRecognizer_ = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)]; doubleTapRecognizer_.numberOfTapsRequired = 2; …
Joshua Goossen
  • 1,714
  • 1
  • 17
  • 36
11
votes
2 answers

didSelectRowAtIndexPath is in conflict with Tap Gesture Recognizer

I've set a Tap Gesture Recognizer in my ViewController via the Storyboard (so all the tap in the view, will hide the keyboard if this one is showed) The thing is that now, I have add a TableView in this View, and when I clic on a cell, the methode…
11
votes
2 answers

Swift: how to make a UIView clickable in UITableViewCell?

Inside a UITableViewCell, I am trying to implement a button with both an image and a text. It seems the standard UIButton cannot achieve that. So I created a UIView which contains a UIImageView and a UILabel. You can see the implementation here on…
Daniele B
  • 19,801
  • 29
  • 115
  • 173
11
votes
4 answers

Disable GestureRecognizer

I have a simple memory game. But i want to turn off the tap function. When I use imageViewGurka1.gestureRecognizers=NO; it works, but I get the warning message: Initialization of pointer of type 'NSArray *' to null from a constant boolean…
user3266053
  • 175
  • 1
  • 1
  • 10
11
votes
4 answers

Receive tap gestures only on part of a view

I have a UIImageView in a view controller. Is it possible to make certain areas of the image view tappable? Example : I have an image of a map. Make only the POIs tappable. Not the whole image. Is this possible?
Isuru
  • 30,617
  • 60
  • 187
  • 303
11
votes
3 answers

Sending arguments to gesture recognizer initialization selector?

In my program, I have a UITapGestureRecognizer which I have initialized with initWithTarget: action:. I have passed in a selector to call a method by the name of PlanetTapped: (UIImageView *)aPlanet. This calls the method fine, however I would like…
Fitzy
  • 1,871
  • 6
  • 23
  • 40
10
votes
2 answers

how to detect tap on UIWebView if it's not a link

So I would like to detect a tap on UIWebView if it is not tapping on a link. How do I do this? I know that: - (BOOL)webView:(UIWebView *)webview shouldStartLoadWithRequest:(NSURLRequest *)request…
xonegirlz
  • 8,889
  • 19
  • 69
  • 127
10
votes
2 answers

iOS How to dismiss UIAlertView with one tap anywhere?

I want to dismiss UIAlertView anywhere outside it with one tap. I want to show a UIAlertView without any button. I have standard UIAlertView codes here, but I need input how to dismiss it, if it is possible. With UITouch? With…
wagashi
  • 894
  • 3
  • 15
  • 39
10
votes
2 answers

SwiftUI: Cancel TapGesture on parent view

I have view hierarchy in SwiftUI like ParentView { //other views ChildView().highPriorityGesture(TapGesture().onEnded { print("Tap!") }) // other views }self.gesture(tap) And I want to have parent…
Michał Ziobro
  • 10,759
  • 11
  • 88
  • 143
10
votes
8 answers

AVPlayer UITapGestureRecognizer not working

I have this code for my AVPlayerViewController. UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAvPlayer)]; [self.avPlayerViewController.view addGestureRecognizer:tap]; but this is not working..…
10
votes
1 answer

Convert touch location of UITapGestureRecognizer for SpriteKit - Swift

I created a game with a SceneKit scene into a UIViewController. I implemented a UITapGestureRecognizer like this : // TAP GESTURE let tapGesture = UITapGestureRecognizer(target: self, action:…
fredericdnd
  • 968
  • 1
  • 14
  • 25
10
votes
2 answers

passing parameters to a Selector in Swift

I am building an app for keeping track of reading assignments for a university course. Each ReadingAssignment has included a Bool value that indicates if the reader has finished reading the assignment. The ReadingAssignments are collected into…
Cyrus Price
  • 121
  • 1
  • 1
  • 7
10
votes
5 answers

Detect tap on UIImageView IOS

Am I doing something wrong? I can't detect the tap on the UIImageview. The UIImageView *myImage is create in storyboard. the code files are here : https://drive.google.com/folderview?id=0B2jWw-2wZC52NDBFZ2lXUTUzQXM&usp=sharing File:…
user1172579
  • 575
  • 1
  • 7
  • 22
10
votes
2 answers

UITapGestureRecognizer not work when I animate the UIImageView

When I want to animate the UIImageView, the UITapGestureRecognizer added to it can not work. WHY??? -(void) testTap:(id)sender { NSLog(@"Test tap..."); } -(void) testSlide { UITapGestureRecognizer* testTap = [[[UITapGestureRecognizer alloc]…
SamirChen
  • 1,209
  • 1
  • 12
  • 22
10
votes
2 answers

How to pass argument to action in UIGestureRecognizer initWithTarget action

I am using the code below UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(processTap)]; - (void) processTap { //do something } But I need to send a data to processTap function. Is there anyway to…
mommomonthewind
  • 4,390
  • 11
  • 46
  • 74