How do I add a segue to an UIGestureRecognizer

扶醉桌前 提交于 2019-12-07 02:07:25

问题


I am building an app for the first time using Storyboards. I have a scene which I would like to have open another scene when there is a long tap on a particular button. I am able to add the UILongPressGestureRecognizer with no problem, but I can't figure out how to have that gesture be the segue to the other scene. Doesn't seem to matter what I Ctrl-Drag, nothing works.

Am I missing something obvious?

Thanks, Ken


回答1:


You can control-drag from your first controller's window to your second controller to create the segue, and then you can call performSegueWithIdentifier in your GestureRecognizer method.




回答2:


It's now possible to do it all in your Storyboard visually. Every gesture recognizer has Triggered Segues in Connections Inspector.



来源:https://stackoverflow.com/questions/11888891/how-do-i-add-a-segue-to-an-uigesturerecognizer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!