UIGestureRecognizer blocks subview for handling touch events

I had a very similar problem and found my solution in this SO question. In summary, set yourself as the delegate for your UIGestureRecognizer and then check the targeted view before allowing your recognizer to process the touch. The relevant delegate method is: – (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch

Gesture recognizer and button actions

In the “shouldReceiveTouch” method you should add a condition that will return NO if the touch is in the button. This is from apple SimpleGestureRecognizers example. – (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { // Disallow recognition of tap gestures in the segmented control. if ((touch.view == yourButton)) {//change it to your condition return NO; } return … Read more

Disable gesture to pull down form/page sheet modal presentation

In general, you shouldn’t try to disable the swipe to dismiss functionality, as users expect all form/page sheets to behave the same across all apps. Instead, you may want to consider using a full-screen presentation style. If you do want to use a sheet that can’t be dismissed via swipe, set isModalInPresentation = true, but … Read more

How do I Disable the swipe gesture of UIPageViewController?

The documented way to prevent the UIPageViewController from scrolling is to not assign the dataSource property. If you assign the data source it will move into ‘gesture-based’ navigation mode which is what you’re trying to prevent. Without a data source you manually provide view controllers when you want to with setViewControllers:direction:animated:completion method and it will … Read more

UIPanGestureRecognizer – Only vertical or horizontal

Just do this for the vertical pan gesture recognizer, it works for me: – (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)panGestureRecognizer { CGPoint velocity = [panGestureRecognizer velocityInView:someView]; return fabs(velocity.y) > fabs(velocity.x); } And for Swift: func gestureRecognizerShouldBegin(_ gestureRecognizer: UIPanGestureRecognizer) -> Bool { let velocity = gestureRecognizer.velocity(in: someView) return abs(velocity.x) > abs(velocity.y) }

UITapGestureRecognizer – single tap and double tap

UITapGestureRecognizer *singleTap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doSingleTap)] autorelease]; singleTap.numberOfTapsRequired = 1; [self.view addGestureRecognizer:singleTap]; UITapGestureRecognizer *doubleTap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doDoubleTap)] autorelease]; doubleTap.numberOfTapsRequired = 2; [self.view addGestureRecognizer:doubleTap]; [singleTap requireGestureRecognizerToFail:doubleTap]; Note: If you are using numberOfTouchesRequired it has to be .numberOfTouchesRequired = 1; For Swift let singleTapGesture = UITapGestureRecognizer(target: self, action: #selector(didPressPartButton)) singleTapGesture.numberOfTapsRequired = 1 view.addGestureRecognizer(singleTapGesture) let … Read more

UIGestureRecognizer on UIImageView

Check that userInteractionEnabled is YES on the UIImageView. Then you can add a gesture recognizer. imageView.userInteractionEnabled = YES; UIPinchGestureRecognizer *pgr = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)]; pgr.delegate = self; [imageView addGestureRecognizer:pgr]; [pgr release]; : : – (void)handlePinch:(UIPinchGestureRecognizer *)pinchGestureRecognizer { //handle pinch… }

How to call gesture tap on UIView programmatically in swift

You need to initialize UITapGestureRecognizer with a target and action, like so: let tap = UITapGestureRecognizer(target: self, action: #selector(self.handleTap(_:))) myView.addGestureRecognizer(tap) Then, you should implement the handler, which will be called each time when a tap event occurs: @objc func handleTap(_ sender: UITapGestureRecognizer? = nil) { // handling code } So now calling your tap gesture … Read more

Can you attach a UIGestureRecognizer to multiple views?

A UIGestureRecognizer is to be used with a single view. I agree the documentation is spotty. That UIGestureRecognizer has a single view property gives it away: view The view the gesture recognizer is attached to. (read-only) @property(nonatomic, readonly) UIView *view Discussion You attach (or add) a gesture recognizer to a UIView object using the addGestureRecognizer: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)