Discussion:
Can I generate a segue this way?
(too old to reply)
Rick Aurbach
2018-06-07 05:14:14 UTC
Permalink
I have a situation where I want a user tap on a UILabel to generate a segue. (Yes, it sounds a bit strange, but it makes sense in context.)

Working with a storyboard, I add a Tap Gesture Recognizer, connect it to the label, and connect the segue to the gesture recognizer. I think I've set everything up correctly, but tapping on the label does not trigger the segue.

Before I spend even more time double-checking my setup, I would like to ask if this is possible. I.e., should I be able to trigger a segue from a gesture recognizer? (IB lets me do it...) and if so, is my approach correct? I figure I ought to be able to do this programmatically, but working in the storyboard is just so much nicer... By the way (if this makes a difference), the segue is connected to a Storyboard Reference, rather than to a scene in the current storyboard. Could this be the problem?

What do you think?

Cheers,

Rick Aurbach

_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.net
Ben Kennedy
2018-06-07 05:18:25 UTC
Permalink
Post by Rick Aurbach
Working with a storyboard, I add a Tap Gesture Recognizer, connect it to the label, and connect the segue to the gesture recognizer. I think I've set everything up correctly, but tapping on the label does not trigger the segue.
You might need to verify that “user interaction” is enabled for the label (which, if I recall correctly, it is not by default).

b

(Hitting both lists huh? :))


_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.n
Rick Aurbach
2018-06-07 15:02:20 UTC
Permalink
Ben,

Thank you so much! You were SO right.

It’s actually rather interesting, because if I subclass UILabel and build the gesture recognizer into it, I don’t need to turn on the ‘user interaction’ setting, but if I use the “bare” UILabel class and attach a gesture recognizer in IB, I do.

Thanks again for the help.

Cheers,

Rick Aurbach
Post by Ben Kennedy
Post by Rick Aurbach
Working with a storyboard, I add a Tap Gesture Recognizer, connect it to the label, and connect the segue to the gesture recognizer. I think I've set everything up correctly, but tapping on the label does not trigger the segue.
You might need to verify that “user interaction” is enabled for the label (which, if I recall correctly, it is not by default).
b
(Hitting both lists huh? :))
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.nark
Continue reading on narkive:
Loading...