uitapgesturerecognizer

shouldReceiveTouch on UITableViewCellContentView

不羁的心 提交于 2019-11-30 11:39:37
I'm trying to ignore UITapGestureRecognizer taps on a UITableView with the following: - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { if ([touch.view isKindOfClass:[UITableViewCellContentView class]]) { return NO; // ignore the touch } return YES; // handle the touch } It won't compile: "Use of undeclared identifier 'UITableViewCellContentView' Undocumented class? Need to subclass? Better way to accomplish this? Thanks for any help. Jimmy_m This seems to do it: - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer

UITapGestureRecognizer with target - Swift

浪尽此生 提交于 2019-11-30 11:02:43
I tried to make a simple tap gesture and I can't figure it out. I want to add a target, simple selector to the gesture. Here is my code : var panGesture : UIGestureRecognizer = UITapGestureRecognizer.addTarget(<#UIGestureRecognizer#>) How can I set selector? Kris Gellci Should look something like this: var tapGesture = UITapGestureRecognizer(target: self, action: "SomeMethod") self.view.addGestureRecognizer(tapGesture) Swift 3: Adding Tap Gesture Target: sampleTapGesture = UITapGestureRecognizer(target: self, action: #selector(ViewController.sampleTapGestureTapped(recognizer:))) self.view

pass parameter to UITapGestureRecognizer [duplicate]

你离开我真会死。 提交于 2019-11-30 08:36:07
问题 This question already has answers here : Pass a NSDictionary as parameter to UITapGestureRecognizer (3 answers) Closed 3 years ago . 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"]; NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:ImageURL]]; image.image = [UIImage imageWithData

tap gesture recognizer - which object was tapped?

删除回忆录丶 提交于 2019-11-30 07:48:49
I'm new to gesture recognizers so maybe this question sounds silly: I'm assigning tap gesture recognizers to a bunch of UIViews. In the method is it possible to find out which of them was tapped somehow or do I need to find it out using the point that was tapped on screen? for (NSUInteger i=0; i<42; i++) { float xMultiplier=(i)%6; float yMultiplier= (i)/6; float xPos=xMultiplier*imageWidth; float yPos=1+UA_TOP_WHITE+UA_TOP_BAR_HEIGHT+yMultiplier*imageHeight; UIView *greyRect=[[UIView alloc]initWithFrame:CGRectMake(xPos, yPos, imageWidth, imageHeight)]; [greyRect setBackgroundColor:UA_NAV_CTRL

iOS - Multiple Tap gesture recognizers

江枫思渺然 提交于 2019-11-30 04:53:28
问题 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 action:@selector(handleSingleTapGestureOnAnimal:)]; oneTap.numberOfTapsRequired = 1; UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTapGestureOnAnimal:)]; doubleTap.numberOfTapsRequired = 2; [doubleTap

How to get the indexpath of a custom table view cell when an UIImage inside of it is tapped and captured by UITapGestureRecognizer in prepareForSegue

若如初见. 提交于 2019-11-29 18:13:11
Ok a lot of variables in the title, sorry I couldn't make it any more simpler. First, I have a custom table cell with descriptions like so now, when a user taps on the cell itself, it would go to View A, however, there is a UITapGestureRecognizer that is connected to the UIImage at the left, which is connected to a segue that goes to View B. All is fine, but I need some data that is inside the table view cell that I can pass to View B so it can do some stuff once the view is shown. override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if(segue.identifier == "toViewA") {

hitTest:WithEvent and Subviews

不羁岁月 提交于 2019-11-29 18:12:41
问题 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, even not inside the original bounds ) even though i loop through my TestView1 hittest method and the points get contained in the frame. #import "ViewController.h" @interface TestView1 : UIView @end @implementation TestView1 - (UIView *)hitTest:

UITapGestureRecognizer with target - Swift

為{幸葍}努か 提交于 2019-11-29 16:29:43
问题 I tried to make a simple tap gesture and I can't figure it out. I want to add a target, simple selector to the gesture. Here is my code : var panGesture : UIGestureRecognizer = UITapGestureRecognizer.addTarget(<#UIGestureRecognizer#>) How can I set selector? 回答1: Should look something like this: var tapGesture = UITapGestureRecognizer(target: self, action: "SomeMethod") self.view.addGestureRecognizer(tapGesture) 回答2: Swift 3: Adding Tap Gesture Target: sampleTapGesture =

How to compare the types of gestures on iOS?

时光毁灭记忆、已成空白 提交于 2019-11-29 12:03:49
I have three different gestures with two different types on one view. First is a UITapGestureRecognizer and the two others are UILongPressGestureRecognizer . The long press gesture recognizer have different minimumPressDuration , one is 0.15 and the other is 0.50 , so to I implemented he following function so that all the gestures are recognized: -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer: (UIGestureRecognizer *) otherGestureRecognizer{ return true; } The function does allow all the gestures to be recognized but the

iOS - UITapGestureRecognizer - Selector with Arguments

好久不见. 提交于 2019-11-29 11:44:35
问题 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 when I tap it. UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapped:)]; [plantImageView addGestureRecognizer:tapGesture]; My problem is that I don't know what image I have tapped. I