uitapgesturerecognizer

Add UITapGestureRecognizer to UITextView without blocking textView touches

北战南征 提交于 2019-11-27 02:17:21
问题 How can I add a UITapGestureRecognizer to a UITextView but still have the touches getting through to the UITextView as normal ? Currently as soon as I add a custom gesture to my textView it blocks the tap for UITextView default actions like positioning the cursor. var tapTerm:UITapGestureRecognizer = UITapGestureRecognizer() override func viewDidLoad() { tapTerm = UITapGestureRecognizer(target: self, action: "tapTextView:") textView.addGestureRecognizer(tapTerm) } func tapTextView(sender

Button tap and long press gesture

∥☆過路亽.° 提交于 2019-11-26 22:50:46
问题 I'm having a little trouble with the gestures. I'm trying to use both tap and long press on the same button, so I've used @IBAction func xxx (sender: UITapGestureRecognizer) and @IBAction func xxx (sender: UILongPressGestureRecognizer) but my button seems to react to both functions when I tap. What might be wrong? func long(longpress: UIGestureRecognizer){ if(longpress.state == UIGestureRecognizerState.Ended){ homeScoreBool = !homeScoreBool }else if(longpress.state == UIGestureRecognizerState

UITapGestureRecognizer tap on self.view but ignore subviews

谁说我不能喝 提交于 2019-11-26 22:33:12
问题 I need to implement a feature that will invoke some code when I double tap on the self.view (view of UIViewCotroller ). But the problem that I have other UI object on this view and I don't want to attach any recognizer object to all of them. I found this method below how to make gesture on my view and I know how it works. Right now I am in front of handicap which way to choose for create this recognizer ignoring subview. Any ideas? Thanks. UITapGestureRecognizer *doubleTap = [

ScrollView gesture recognizer eating all touch events

僤鯓⒐⒋嵵緔 提交于 2019-11-26 21:59:15
I have a UIScrollView to which I added a single tap gesture recognizer to show/hide some UI overlay using: UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]; [scrollView addGestureRecognizer:singleTap]; and: - (void)handleTap:(UITapGestureRecognizer *)sender { // report click to UI changer } I added an easy table view to the bottom of the UIScrollView . Everything works right (scrolling both horizontally and vertically) but the problem is that taps are recognized only by the gesture recognizer (above), but not by the easy

How do I implement the UITapGestureRecognizer into my application

守給你的承諾、 提交于 2019-11-26 19:00:26
I am quite new to programming and Objective C. I was wondering how to make an app which has a blank screen and a timer that goes for one minute. You are meant to tap as fast as you can and as long as you can for. I was wondering how to implement the UITapGestureRecognizer into my code. Mathew Varghese This is a step by step guide on how to implement gesture recognizers in your class: Conform your class to UIGestureRecognizerDelegate protocol. Instantiate the gesture recognizer. For example, to instantiate a UITapGestureRecognizer , we will do: UITapGestureRecognizer *tapGestureRecognizer = [

How to make a UILabel clickable?

放肆的年华 提交于 2019-11-26 18:37:03
I would like to make a UILabel clickable. I have tried this, but it doesn't work: class DetailViewController: UIViewController { @IBOutlet weak var tripDetails: UILabel! override func viewDidLoad() { super.viewDidLoad() ... let tap = UITapGestureRecognizer(target: self, action: Selector("tapFunction:")) tripDetails.addGestureRecognizer(tap) } func tapFunction(sender:UITapGestureRecognizer) { print("tap working") } } Claudiu Iordache Have you tried to set isUserInteractionEnabled to true on the tripDetails label? This should work. liorco Swift 3 Update Replace Selector("tapFunction:") with

How to enable “tap and slide” in a UISlider?

喜你入骨 提交于 2019-11-26 17:10:01
问题 What I want to get is a UISlider which lets the user not only slide when he starts on its thumbRect , but also when he taps elsewhere. When the user taps on the slider but outside of the thumbRect , the slider should jump to that value and then still keeping up to the user's sliding gesture . What I have tried so far was implementing a subclass of UIGestureRecognizer like in this suggestion. It starts right then when a touch down somewhere outside the thumbRect occurs. The problem is that the

Passing through touches to UIViews underneath

送分小仙女□ 提交于 2019-11-26 15:48:50
问题 I have a UIView with 4 buttons on it and another UIView on top of the buttons view. The top most view contains a UIImageView with a UITapGestureRecognizer on it. The behavoir I am trying to create is that when the user taps the UIImageView it toggles between being small in the bottom right hand corner of the screen and animating to become larger. When it is large I want the buttons on the bottom view to be disabled and when it is small and in the bottom right hand corner I want the touches to

UITapGestureRecognizer - make it work on touch down, not touch up?

冷暖自知 提交于 2019-11-26 15:06:36
What I'm using the tap event for is very time-sensitive, so I'm curious if it's possible to make UITapGestureRecognizer activate when the user simply touches down, rather than requiring them to touch up as well? LE SANG Create your custom TouchDownGestureRecognizer subclass and implement gesture in touchesBegan: TouchDownGestureRecognizer.h #import <UIKit/UIKit.h> @interface TouchDownGestureRecognizer : UIGestureRecognizer @end TouchDownGestureRecognizer.m #import "TouchDownGestureRecognizer.h" #import <UIKit/UIGestureRecognizerSubclass.h> @implementation TouchDownGestureRecognizer -(void

How to tap to zoom and double tap to zoom out in iOS?

£可爱£侵袭症+ 提交于 2019-11-26 14:34:47
I'm developing an application to display a gallery of UIImages by using a UIScrollView , my question is, how to tap to zoom and double tap to zoom out, how does it work when handling with UIScrollView . You need to implement UITapGestureRecognizer - docs here - in your viewController - (void)viewDidLoad { [super viewDidLoad]; // what object is going to handle the gesture when it gets recognised ? // the argument for tap is the gesture that caused this message to be sent UITapGestureRecognizer *tapOnce = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOnce:)];