How do I use performSegueWithIdentifier: sender:? [duplicate]

房东的猫 提交于 2019-11-30 03:43:33

To make a kind of 'splash screen' for your app, just create the view for it in your Storyboard and set it as the entry point (or root of a Navigation Controller etc). Create a segue like you have previously, except drag a segue from the 'Splash' view controller, to the 'Main Menu' controller. With the segue selected, set its Identifier in the Attributes inspector to ShowMainMenu.

Create a method in the 'Splash' view controller that performs the segue:

- (void)showMainMenu {
    [self performSegueWithIdentifier:@"ShowMainMenu" sender:self];
}

In the 'Splash' view controller's viewDiDLoad method, add:

[self performSelector:@selector(showMainMenu) withObject:nil afterDelay:5.0];

There you have it!

DerWOK

This does not answer your segue question. But it solves your root problem of displaying a splash screen in an ios app:

What you describe (and what many app show) is a "Launch Image". No need to code it at your own. In Xcode just go to the settings of your target, then "Summary" and add some launch images.

You have to provide launch images for different display resolutions and devices.

If you want to show the image for at least 5 seconds, see here: increase launch image time on xcode

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