uitapgesturerecognizer

Double tap Gesture on UICollectionViewCell?

China☆狼群 提交于 2019-12-11 12:17:40
问题 I want to double tap on the UICollectionViewCell to like the profile just like OkCupid App . I have applied Tap Gesture on Collection View but it does not work. When I try to double tap the cell every time didSelectCollectionViewCell Method call. 回答1: You have to add the double tap gesture recognizer to the collection view instead of the cell. In its action selector you could determine which cell was double tapped override func viewDidLoad() { var doubleTapGesture: UITapGestureRecognizer =

UITapGestureRecognizer causes app to crash

安稳与你 提交于 2019-12-11 09:38:48
问题 UITapGestureRecognizer causes app to crash when a swipe is done. Swipes done over very short distances do not cause any problems, but those done over a longer distance give the error : -[UITapRecognizer name]: unrecognized selector sent to instance 0x17ee27c0 where 0x17ee27c0 is a random value. *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITapRecognizer name]: unrecognized selector sent to instance 0x17ee27c0' *** First throw call stack: (0x2cb7dc1f

How to detect touch on UICollectionView?

大憨熊 提交于 2019-12-11 09:26:49
问题 I want to disable UICollectionViewController's autorotation whenever there's a finger on the screen, as the iPhone photo app does. How to do that? If use tap gesture, how to distinguish different touch states? (The state should be touching , even after finger moving.) If use touchBegan:withEvent: , where to put that code? (The hit view can be any subview of UICollectionView.) 回答1: I would set a flag in touchesBegan and clear it in touchesEnded . Then in your shouldAutoRotate method you can

ios uiimageview tap gesture not working during animation

ⅰ亾dé卋堺 提交于 2019-12-11 06:59:05
问题 I have a UIImageView that is animated and receiving a UITapGestureRecognizer . The problem is while animated, the tap gesture area doesn't move with the view. I can tap the view's original location and the tap gesture is recognized. Anyone know how to have the tap recognized while the view is moving and not at its original position? Edit 1: This is how I've set up my tap gesture recognizer: UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:

issue while dropping pin to imageview on different devices

耗尽温柔 提交于 2019-12-11 05:56:39
问题 i am dropping pin image on imageview with coordinates so pin set correctly but there is minor position difference in various devices i am sharing my code below func convertTapToImg(_ point: CGPoint) -> CGPoint? { let xRatio = imgView.frame.width / (img?.size.width)! let yRatio = imgView.frame.height / (img?.size.height)! let ratio = min(xRatio, yRatio) let imgWidth = (img?.size.width)! * ratio let imgHeight = (img?.size.height)! * ratio var tap = point var borderWidth: CGFloat = 0 var

UITextField TapGesture doesn't respond on iOS 7.1

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 02:08:12
问题 I have a uitextfield which is programatically added to view. I need to show a UIPickerview, when i tap on that, I have added a UITapgestureRecognizer for that and user interaction also enabled. Which was working fine till IOS 7.0. But when i updated to IOS 7.1 which is not getting called. 回答1: Rather than setting a tap gesture for your textField , you can simply set the inputView of your textField as your pickerView . This simply enables you to show the UIPicker when the textField is tapped

UIBarButtonItem's action is not called when in a view with a UIGestureRecognizer

佐手、 提交于 2019-12-11 01:29:21
问题 I have a simple UIViewController derived controller which has UITextFields. Also using IB, I placed a UIToolbar and two UIBarButtonItems. I Ctrl-Drag to add actions to the buttons. - (IBAction)cancel:(id)sender { ... } - (IBAction)save:(id)sender { ... } If I run the code, the actions get called. The problem : I wanted to implement the tap on background to resignFirstResponder paradigm , so I added a UITapGestureRecognizer on the root view: - (void)viewDidLoad { ... UITapGestureRecognizer

UIMenuController not working as expected, canPerformAction not getting fired

╄→尐↘猪︶ㄣ 提交于 2019-12-10 22:47:11
问题 I ran into a problem lately. The UITapgesture working on simulator perfect and even while debugging directly on the device (iPhone 4, iOS 5.0.1) but when I package the app (Dep_Target iOS4.0m Base_SDK iOS5.1(latest)) for adhoc distribution and send it to client the gestures doesn't work. I then installed the build via test flight on the same device which I am using for debugging, the gesture doesn't work on it. I rechecked everything, I am using same build for distribution. Any help will be

tap gesture recognizer not working…?

て烟熏妆下的殇ゞ 提交于 2019-12-10 22:42:33
问题 I had to create a new thread bcoz it's driving me crazy and all the other answers online are exactly the same. I have done this countless of times but I cannot see what I am missing for the life of me. I am using a "test" view controller just to get the tap gesture working but it isn't working at all... I am fairly certain that I am setting this up correctly, as this is how I've always implemented it in the past: (yes, I have checked the box for isUserInteractionEnabled). I am even

Recognizing multiple UILabels tap for UITapGestureRecogniser

人走茶凉 提交于 2019-12-10 21:00:33
问题 In my view load I have two UILabels and I have added same tapGesture for both.If a particular label is tapped then its functionality should be performed.But I m unable to do so ? -(void)viewDidLoad{ lblEditProfile.userInteractionEnabled = YES; UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(labelClicked:)]; [tapGestureRecognizer setNumberOfTapsRequired:1]; [lblEditProfile addGestureRecognizer:tapGestureRecognizer];