Defining a “generic” segue in Interface Builder

删除回忆录丶 提交于 2019-12-22 03:42:35

问题


I understand how to create a segue in XCode 4.2 by right clicking a control, let's say a button, and dragging it to a view controller in the storyboard.

What I would like to do is create a segue that is not tied to a control, and must be invoked programmatically so I can do something like this:

- (void)viewDidLoad
{
    if (condition) 
    {
        [self performSegueWithIdentifier: @"identifier" sender: self];
    }
}

while still defining the "identifier" segue within Interface Builder. Is this possible?


回答1:


You can ctrl-drag from the source view controller to the other scene. You can use the view controller object at the bottom of the scene to do this.

Then of course give it the appropriate identifier and then your code above should work fine.

Hope that helps.



来源:https://stackoverflow.com/questions/8484688/defining-a-generic-segue-in-interface-builder

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