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
6
votes
3 answers

UITapGestureRecognizer does not respond to subview area outside parent view

I have a UIView called view1. view1 has a subview called subview. I added UITapGestureRecognizer to subview as follow: UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTap:)]; [subview…
user523234
  • 14,323
  • 10
  • 62
  • 102
5
votes
3 answers

Getting Tag from Tap Gesture Recognizer

I've got an array of UIImageViews and have programmatically assigned tap gesture recognizers to them. myImages.forEach{ UIImageView in let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap(gesture:))) …
moosgrn
  • 379
  • 3
  • 13
5
votes
3 answers

How to add gesture for a view inside a collection view cell?

I am adding a view having set of images(socialView) inside a collection view cell(having other views also) on which a common click has to be performed. This click should not be same as collection view cell click. I am thinking of adding…
DevAnuragGarg
  • 1,592
  • 2
  • 14
  • 18
5
votes
3 answers

UILongPressGestureRecognizer breaks tableView scrolling

I created a custom Label class that contains a UILongPressGestureRecognizer, and I am invoking it in tableview cells in a TableViewController. The long press gesture recognizer works (two clickable zones in an attributed sting), but the tableView…
lucius degeer
  • 403
  • 1
  • 6
  • 17
5
votes
3 answers

Single and double taps on UITableViewCell in Swift 3

I have storyboard segue on TableViewCell, which I use for transfering to another VC on cell click in didSelectRowAt method. Now I made double tap TapGestureRecognizer to handle touble tap on cell. Problem is that on single tap, segue is performing…
bzadm
  • 133
  • 2
  • 9
5
votes
3 answers

How to add function-call (not hyperlink) to part of an NSAttributedString in a UILabel?

I need to add some tapGestures to some part of a text, thats in a UILabel. It seems to be able to make a hyperlink - so I guess its possible to make a functioncall as well, but I'm just not sure how to do it. Heres my code: let regularFont =…
5
votes
1 answer

UITapGestureRecognizer on a UIButton

I have a UIButton which has an IBAction as well as a UITapGestureRecognizer to detect double taps. At the moment it looks like the IBAction is blocking the recognizer. Is there a way to stop this or do UITapGestureRecognizer even work on buttons?…
some_id
  • 29,466
  • 62
  • 182
  • 304
5
votes
2 answers

UITableViewCell tap on subview without cell selection

I have a custom tableviewCell with an UIImageView imgView inside. I added UITapGestureRecognizer to imgView, so that I can change image of imgView whenever I tap to it. However, when I tap to imgView, didSelectRowAtIndexPath is also triggered. What…
5
votes
2 answers

Passing arguments to #selector method in swift

I want to pass multiple argument to a function while I click an image. Here is my code var param1 = 120 var param2 = "hello" var param3 = "world" let image: UIImage = UIImage(named: "imageName")! bgImage = UIImageView(image: image) let singleTap…
Vinod
  • 675
  • 3
  • 7
  • 25
5
votes
6 answers

Tap Gesture on animating UIView not working

I have a tap gesture on a UILabel who's translation is being animated. Whenever you tap on the label during the animation there's no response from the tap gesture. Here's my code: label.addGestureRecognizer(tapGesture) …
mlevi
  • 1,433
  • 3
  • 18
  • 30
5
votes
2 answers

Detecting double and single tap on UITableViewCell to perform two action

I have a PFQueryTableViewController in which I am trying to learn some tableView interactions. What I currently have: The tableView cell increases its height on a tap didSelectRowAtIndexPath or I can basically segue cell related data to next…
5
votes
1 answer

UITapGestureRecognizer not working when clicking on a DatePicker

I am using this code to dismiss keyboard when user click's outside the TextField override func viewDidLoad() { ... let tapGesture = UITapGestureRecognizer(target: self, action: "tap:") view.addGestureRecognizer(tapGesture) ... } func…
Mucida
  • 603
  • 9
  • 24
5
votes
2 answers

get UIImage from sender in swift

I have a UIImageView inside a table cell and I added a tapGesture to it. I want to access the UIImageView in the handleTap method. This is the code for the Image inside the TableCell : func setImageForCell(cell:ImageCell, indexPath:NSIndexPath) { …
plasmid0h
  • 186
  • 2
  • 13
5
votes
4 answers

Add a click event to some text in ios NSString

I have the following code and want to make parts of my text be clickable and call another UIViewController (not a website). NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"testing it out @clickhere"]; NSInteger…
cdub
  • 24,555
  • 57
  • 174
  • 303
5
votes
2 answers

Getting UITapGestureRecognizer's sender in Swift

So I'm working on a selector that reminds users to pan the object instead of tapping it. The following code is the animation: func labelTapped(sender:UITapGestureRecognizer)->Void{ UIView.animateWithDuration(0.2, delay: 0, options:…
ddolce
  • 739
  • 2
  • 10
  • 30