如何在一段时间内自动从一个视图控制器移动到另一个视图控制器?

How to move from one view controller to another Automatically with some time?

我是这个开发的新手,我正在使用启动画面,但我不知道如何在一段时间内从一个视图控制器移动到另一个视图控制器...

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

我不知道怎么加时间请大家帮忙.....

Timer Documentation

Timer.scheduledTimer(withTimeInterval: 5, repeats: false) { (timer) in
      self.performSegue(withIdentifier: "nameOfYourSegue", sender: nil)
 }

你可以试试

// delay 1 second

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

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

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];
});

在viewDidLoad中添加这段代码

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

然后,

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

如果你想在初始视图控制器之前显示启动画面,你应该阅读 Apple 的 Human Interface Guidelines

另外,这里有一个简单的 tutorial 可以帮助您创建自己的启动画面。

编码愉快 ;)