iOS and xcode: how to give a segue a “storyboard id” so that I can programmatically manipulate it

烈酒焚心 提交于 2019-12-10 19:58:13

问题


I am wanting to create a modal segue from a view controller to an a new view, but not by linking the segue action to a button or anything. Instead, I'd like to just set the segue up so that I can call it in pageDidLoad and have it automatically execute if I want.

To do this, I need to be able to reference the segue, such as this:

[self performSegueWithIdentifier:@"mySegue" sender: ...];

After I control-click-drag a connection in storyboard to create a segue, how can I give it a name for later reference? Thanks!


回答1:


Link the segue action from curent viewController to new view controller. I think this you want, see the screenshot.

This link will help you for remaining code.




回答2:


Nevermind! In the details pane sidebar of xcode, under the third tab there is an "Identifier" field that can be filled out!



来源:https://stackoverflow.com/questions/16433120/ios-and-xcode-how-to-give-a-segue-a-storyboard-id-so-that-i-can-programmatica

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