uitapgesturerecognizer

How to capture Tap gesture on MKMapView

你。 提交于 2019-11-26 12:09:17
问题 I am trying to capture tap event on my MKMapView , this way I can drop a MKPinAnnotation on the point where user tapped. Basically I have a map overlayed with MKOverlayViews (an overlay showing a building) and I would like to give user more information about that Overlay when they tap on it by dropping a MKPinAnnotaion and showing more information in the callout. Thank you. 回答1: You can use a UIGestureRecognizer to detect touches on the map view. Instead of a single tap, however, I would

UIButton inside a view that has a UITapGestureRecognizer

半城伤御伤魂 提交于 2019-11-26 10:59:56
I have view with a UITapGestureRecognizer . So when I tap on the view another view appears above this view. This new view has three buttons. When I now press on one of these buttons I don't get the buttons action, I only get the tap gesture action. So I'm not able to use these buttons anymore. What can I do to get the events through to these buttons? The weird thing is that the buttons still get highlighted. I can't just remove the UITapGestureRecognizer after I received it's tap. Because with it the new view can also be removed. Means I want a behavior like the fullscreen vide controls . You

UITapGestureRecognizer breaks UITableView didSelectRowAtIndexPath

余生长醉 提交于 2019-11-26 10:05:01
I have written my own function to scroll text fields up when the keyboard shows up. In order to dismiss the keyboard by tapping away from the text field, I've created a UITapGestureRecognizer that takes care of resigning first responder on the text field when tapping away. Now I've also created an autocomplete for the textfield that creates a UITableView just below the text field and populates it with items as the user enters text. However, when selecting one of the entries in the auto completed table, didSelectRowAtIndexPath does not get called. Instead, it seems that the tap gesture

ScrollView gesture recognizer eating all touch events

孤街浪徒 提交于 2019-11-26 08:08:34
问题 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

How do I implement the UITapGestureRecognizer into my application

不问归期 提交于 2019-11-26 06:44:17
问题 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. 回答1: 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

How to make a UILabel clickable?

≡放荡痞女 提交于 2019-11-26 06:28:41
问题 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\") } } 回答1: Have you tried to set isUserInteractionEnabled to true on the

UITapGestureRecognizer - single tap and double tap

此生再无相见时 提交于 2019-11-26 04:58:58
问题 I am trying to add 2 UITapGestureRecognizers to a view, one for single tap and one for double tap events. The single tap recognizer is working as expected (on its own). But I don\'t seem to be able to get the double tap recognizer working. Have tried to experiment with properties like : cancelsTouchesInView , delaysTouchesBegan and delaysTouchesEnded but still doesn\'t work. When I double tap, the single tap recognizer would always be activated and the double tap event would also be sent to

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

旧巷老猫 提交于 2019-11-26 03:57:22
问题 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 . 回答1: 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 - make it work on touch down, not touch up?

旧街凉风 提交于 2019-11-26 03:49:38
问题 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? 回答1: Create your custom TouchDownGestureRecognizer subclass and implement gesture in touchesBegan: TouchDownGestureRecognizer.h #import <UIKit/UIKit.h> @interface TouchDownGestureRecognizer : UIGestureRecognizer @end TouchDownGestureRecognizer.m #import "TouchDownGestureRecognizer

Create tap-able “links” in the NSAttributedString of a UILabel?

牧云@^-^@ 提交于 2019-11-25 22:31:42
问题 I have been searching this for hours but I\'ve failed. I probably don\'t even know what I should be looking for. Many applications have text and in this text are web hyperlinks in rounded rect. When I click them UIWebView opens. What puzzles me is that they often have custom links, for example if words starts with # it is also clickable and the application responds by opening another view. How can I do that? Is it possible with UILabel or do I need UITextView or something else? 回答1: In