uitapgesturerecognizer

UITapGestureRecognizer called immediately

前提是你 提交于 2019-12-31 01:45:11
问题 I am trying to add a UITapGestureRecognizer to a imageview as shown below let gest=UITapGestureRecognizer(target: self, action: Selector(imgPressed())); gest.delegate=self thalaImg.addGestureRecognizer(gest) And here is the imgPressed function : func imgPressed() { let alert=UIAlertController(title: "Img", message: "img pressed", preferredStyle: .Alert) let okButton=UIAlertAction(title: "Ok", style: .Default, handler: nil) alert.addAction(okButton) presentViewController(alert, animated: true,

UITapGestureRecognizer unrecognized selector sent to instance

夙愿已清 提交于 2019-12-30 06:09:26
问题 I've searched for solutions to this problem but couldn't find anything that seems to address it in my case. I'm getting the above exception from a UITapGestureRecognizer. Here's the simplified code: import UIKit; class ViewController : UIViewController, UIScrollViewDelegate { @IBOutlet weak var scrollView:UIScrollView!; var imageView:UIImageView!; override func viewDidLoad() { super.viewDidLoad(); ... set up imageView/scrollView here ... let doubleTapRecognizer = UITapGestureRecognizer(target

How to compare the types of gestures on iOS?

▼魔方 西西 提交于 2019-12-29 08:16: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 *)

iOS Detect tap down and touch up of a UIView

大憨熊 提交于 2019-12-28 03:45:08
问题 I am stuck with a problem of determining how to detect a UIView being touched down and UIView being tapped. When it is touched down, I want the UIView to change its background color. When it is touched, I would like the UIView to perform certain tasks. I would like to know how I am able to fix this problem. -(void)viewDidLoad { UITapGestureRecognizer *dismissGestureRecognition = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDismissDoubleTap:)];

NSLayoutConsstraint constant not affecting view after UITapGestureRecognizer was tapped

偶尔善良 提交于 2019-12-25 07:41:06
问题 i have a view ( self.view ) that is masked with another view (not a layer) using the UIView.mask property. on self.view i installed a UIPanGestureRecognizer so when i pan across the screen the mask gets smaller and larger accordingly. in addition i installed on self.view a UITapGestureRecognizer which adds animatable UIImageView s to the screen and they are animating across a UIBezierPath . i am updating the mask size with constraints. the problem is that after i tap the screen to add

How to capture Tap gesture on MKMapView

筅森魡賤 提交于 2019-12-25 02:15:54
问题 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

UILabel with Gesture Recognizer inside UITableViewCell blocks didSelectRowAtIndexPath

冷暖自知 提交于 2019-12-25 01:13:26
问题 I use some UILabels with a UITapGestureRecognizer inside a UITableViewCell . The GestureRecognizer works well. But when I tap on the label, I want that the didSelectRowAtIndexPath: should execute too. Or even just the indexPathForSelectedRow() method should give me the selected row. Setting cancelsTouchesInView = false did not work! Is this possible? Right now the indexPathForSelectedRow() method returns nil. Thanks 回答1: Why are you using UITapGestureRecognizer ? If you want to use that, try

UICollectionView and push to detailViewController using Parse

断了今生、忘了曾经 提交于 2019-12-24 11:44:50
问题 I use the tapGesture method to pouch the image from UICollectionView to detailViewController viewController.h as follows: #import <Parse/Parse.h> @interface CardsViewController : UIViewController <UICollectionViewDelegateFlowLayout> { NSMutableArray *allImages; NSArray *cardFileArray; } @property (weak, nonatomic) IBOutlet UICollectionView *imageCollection and viewController.m as the follow - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } -

Xamarin.Forms Warning: Attempt to present * on * whose view is not in the window hierarchy with iOS image/gesture recogniser

可紊 提交于 2019-12-24 01:16:06
问题 I have a modal Navigation page with an image which acts like a button; <Image Source ="share.png" HeightRequest="32" WidthRequest="32"> <Image.GestureRecognizers> <TapGestureRecognizer Tapped="On_Share" /> </Image.GestureRecognizers> </Image> And the method behind; async void On_Share(object sender, EventArgs e) { if (CrossConnectivity.Current.IsConnected) { var message = "Share this"; var title = "Share"; await CrossShare.Current.Share(new ShareMessage { Text = message, Title = title}, new

Adding a tap Gesture that calls a method in another class

删除回忆录丶 提交于 2019-12-24 00:36:58
问题 Simply I want to add a tap gesture for a UIImageView that when the user touches, calls a method that is implemented in another class (not the same class that contains the UIImageView ). Can I do this and if so how can i do it ? 回答1: You can do that. But you need the instance of the target class (class in which method is going to execute) as delegate or something in the gesture adding class. UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self.delegate action