0

I am new to this development and i was working with splash screen but I don't know how to move from one view controller to another with some certain time...

[self performSegueWithIdentifier:@"nameOfYourSegue" sender:self];

I don't know how to add time any help please.....

4 Answers4

0

Timer Documentation

Timer.scheduledTimer(withTimeInterval: 5, repeats: false) { (timer) in
      self.performSegue(withIdentifier: "nameOfYourSegue", sender: nil)
 }
Salman500
  • 1,213
  • 1
  • 17
  • 35
0

You can try

// delay 1 second

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{

    [self performSegueWithIdentifier:@"segueID" sender:nil];
});

OR

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{

    UIViewController*vc = [self.storyboard instantiateViewControllerWithIdentifier:@"VCID"];

    [self presentViewController:vc animated:YES completion:nil];
});
Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87
0

Add this code in viewDidLoad

[self performSelector:@selector(LoadMainPage:) withObject:nil afterDelay:3.0];

and then,

-(void)LoadLoginPage
{
  LoginViewController *loginView=[self.storyboard instantiateViewControllerWithIdentifier:@"loginViewController"];
  [self.navigationController pushViewController:loginView animated:YES];
}
Mukesh
  • 777
  • 7
  • 20
0

If you want to display a splash screen before your initial view controller, you should read the Apple's Human Interface Guidelines.

Also, here is a simple tutorial to help you create your own splash screen.

Happy coding ;)

Lodoss
  • 469
  • 4
  • 11