UIView with Tap Gesture Segue

shadonar

I have a smaller UIView as a subview to the main UIView on my UIViewController. This smaller UIView also has an image and a couple of labels.

What I want is for the user to touch this smaller view (anywhere on this view or it's contents) and then segue to a new UIViewController.

I have added a Tap Gesture to the smaller view and set a segue from the Tap Gesture to the UIViewController I want to show next.

However this only works if the user touches only a space on the view that does not have the labels or image and "User Interaction Enabled" is checked. If the image or labels are touched, nothing happens, and if "User Interaction Enabled" is unchecked, nothing happens.

I've done this entirely from the storyboard, and only implementing a prepareForSegue method.

Is there something I'm missing? Any help would be greatly appreciated, Thanks!

Durican Radu

Remove the user Interaction from all the Labels and images(uiimageview has userinterraction set no by default). If other elements have user interaction enabled, they will catch the touch; if they have user interaction set to no, the next view in hierachy will catch it.

Very important is to remove the interaction from the labels and imageviews, not the view you are touching

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

UIView with Tap Gesture Segue

From Dev

Tap Gesture on animating UIView not working

From Dev

How to trigger tap gesture recognizer of UIView programmatically

From Dev

Pass tap gesture from UIView to underlying AVPlayer

From Dev

How to trigger tap gesture recognizer of UIView programmatically

From Dev

UIView with label + button - Tap gesture not recognized

From Dev

Tap Gesture Recognizer not received in custom UIView embedded in super view

From Dev

Swift: tap Gesture not recognized

From Dev

tap gesture not recognized on uiimageview

From Dev

UITextField and tap gesture in leftView

From Dev

Tap gesture not working for me

From Dev

Tap gesture not detected in UITableViewCell

From Dev

Tap Gesture on part of UILabel

From Dev

tap gesture not recognized on uiimageview

From Dev

CKComponent handle tap gesture

From Dev

Tap Gesture Recognizer is one tap behind

From Dev

How to differentiate single tap gesture and double tap gesture?

From Dev

Double tap gesture on parent view and single tap gesture on child view

From Dev

Add a tap gesture to a part of a UILabel

From Java

SwiftUI ScrollView with Tap and Drag gesture

From Dev

using tap gesture to select row

From Dev

iOS Simulate Single Tap Gesture

From Dev

iOS - Add Tap Gesture to UITextField

From Dev

ios uiimagview tap gesture not recognised

From Dev

Button tap and long press gesture

From Dev

didSelectRowAtIndexPath is in conflict with Tap Gesture Recognizer

From Dev

How to dismiss SDCAlertView with tap gesture?

From Dev

ios uiimagview tap gesture not recognised

From Dev

Set hidden textField on Tap gesture