Reputation: 507
I am trying to make a splash screen, but tutorial says, I should make a segue from StatusBar of the ViewController, where my Splash screen is, to the next one ViewController, that is a start page. This tutorial is obviously too old, because I have the last XCode. How should it be done?
Upvotes: 0
Views: 337
Reputation: 6052
Go to the storyboard
, insert a UINavigationController
and connect it to the UIViewController
you want to make your splash screen. If you haven't created any, you can use the UIVewController
that will be inserted with the UINavigationController
you drag into your storyboard
. Now create new classes
of type UIViewController
and set them as Custom Class
for the splash screen in the storyboard
(inside the Identity inspector
). Into the .m file you have to insert following code to perform a segue
to another UIViewController
:
- (void)viewDidLoad{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self performSelector:@selector(goToLandingPage)
withObject:nil
afterDelay:3.0f];
}
- (void)goToLandingPage{
[self performSegueWithIdentifier:@"landingpage" sender:self];
}
Next you have to create a second UIViewController inside the
storyboardand drag a segue from the splash to the next
UIViewController(don't forget to press
STRG, and zoom out). Click on this
segueand insert the identifier (in the
Attributes Inspector` on the right), in my case landingpage.
Everytime you want to perform a segue programmatically inside your code, you have to select the UIViewController
it self inside the storyboard
and drag it to the controller
you want. Otherwise just use a UIButton
and it will perform by click.
Upvotes: 1