uigesturerecognizer

Tap Gesture not working as expected when added to uiview in collectionview cell

左心房为你撑大大i 提交于 2020-01-13 18:55:49
问题 I am adding a tap gesture recognizer programmatically to a custom collection view cell class. for some reason, it doesnt seem to be working. the frame is not 0, isUserInteractionEnabled is set to true and i made sure the tap view is on top of all other views: The custom cell class: let containerView: UIView = { let view = UIView() view.isUserInteractionEnabled = true view.translatesAutoresizingMaskIntoConstraints = false return view }() let tapView: UIView = { let v = UIView() v

UIgestureRecognizer in a view inside a UIScrollView

巧了我就是萌 提交于 2020-01-13 09:04:09
问题 Has anyone managed to get a UIGestureRecognizer to work on a UIView that is a subview of a UIScrollView? My callbacks never seems to get called. As a simple example, I want to have a paging scrollview and on the third page listen for a tap with a UITapGestureRecognizer. However I can not get it to work. Here's how I would do it: self.scrollView = [[[UIScrollView alloc] initWithFrame:self.view.frame] autorelease]; self.scrollView.pagingEnabled = YES; self.scrollView.contentSize = CGSizeMake

Horizontal UISwipeGestureRecognizer in subview of UIScrollView ? (UIScrollView only needs to recognize vertical scrolling)

岁酱吖の 提交于 2020-01-13 05:45:08
问题 I have a UIScrollView where I added a subview. The scrollview scrolls fine vertically and that is all it should do. I would now like to recognize left/right swipes in the subview with the help of a UISwipeGestureRecognizer. I know it is possible, but I have not come across a solution and several tries have been unsuccessful. 回答1: Try these: Set the delegate of your UIGestureRecognizer and Implement shouldRecognizeSimultaneouslyWithGestureRecognizer : -(BOOL)gestureRecognizer:

How to connect two buttons( dots) with a line in iOS? [duplicate]

♀尐吖头ヾ 提交于 2020-01-13 05:35:09
问题 This question already has answers here : draw line between two points in iphone? (3 answers) Closed 6 years ago . I want to make a project in which I have to touch one dot and connect it with another dot and after connect it to another dot. When I connect one dot with another dot the line will create between them. Actually when I click/ touch one dot The line will show and When I touch second dot the line will create between the two dots. I am not able to do this yet, I am trying and

UIGestureRecognizer subView recognizer problem

跟風遠走 提交于 2020-01-13 03:57:08
问题 The title is hard . The the main case is like this UIView *superView = [[UIView alloc] initWithFrame:CGRectMake(0,0,400,400)]; UIView *subView = [[UIView alloc] initWithFrame:CGRectMake(-200,-200,400,400)]; UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)]; [subView addGestureRecognizer:tapGesture]; [superView addSubView:subView]; OK , you will find that the tap gesture will take effect when you click the area in (0,0,200

UIGestureRecognizer subView recognizer problem

蓝咒 提交于 2020-01-13 03:57:07
问题 The title is hard . The the main case is like this UIView *superView = [[UIView alloc] initWithFrame:CGRectMake(0,0,400,400)]; UIView *subView = [[UIView alloc] initWithFrame:CGRectMake(-200,-200,400,400)]; UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)]; [subView addGestureRecognizer:tapGesture]; [superView addSubView:subView]; OK , you will find that the tap gesture will take effect when you click the area in (0,0,200

Gesture recognition with UIWebView

十年热恋 提交于 2020-01-12 02:18:08
问题 I have set up some gesture recognition in an app that I'm building. One of the gestures is a single finger single tap, which hides the toolbar at the top of the screen. Works great except for one thing: a tap on a link causes the toolbar to go away, too. Is it possible to detect a tap that was not a tap on a link? Could I do this by seeing where the tap occurred, and only take action if it didn't occur on an html link? Is this is possible, a pointer to how to determine if a link was tapped

UICollectionView drag finger over cells to select them

◇◆丶佛笑我妖孽 提交于 2020-01-11 20:00:54
问题 Using UICollectionView , is it possible to select multiple cells by dragging your finger over a few of them? E.g., if you drag your finger over a row of 6, and down into the next row, it would select all of them. Tried something simple: UISwipeGestureRecognizer *swipeGuesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeGesture:)]; [self.collectionView addGestureRecognizer:swipeGuesture]; But that seemed to only call the method on the first cell that was

How to intercept long press on UITextView without disabling context menu?

血红的双手。 提交于 2020-01-10 18:54:28
问题 I want to intercept long press on UITextview, but don't want to disable the context menu option at the same time. If I use gesture recognizer on textview, it will disable context menu so I am using the method like below now. - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { //fire my method here } But, it only fires the method when context menu shows up after the user long press some words. So when the user long press a blank space, then only the magnifying glass shows up, I can't

UITextView startInteractionWithLinkAtPoint crash iOS 11 only

感情迁移 提交于 2020-01-09 10:48:07
问题 So I experience crash in UItextview while user interacts with URL link there. All crash reports have iOS version 11 only. This looks like well-known bug in iOS 9, but there is no single report iOS versions lower than 11, and also in report I found interesting line: UITextGestureClusterLinkInteract smallDelayRecognizer: which came with iOS 11 (http://developer.limneos.net/?ios=11.0&framework=UIKit.framework&header=UITextGestureClusterLinkInteract.h). Anyway, for now I fixed it with @available