在Splash Screen之后如何选择UIViewController?

时间:2013-08-07 18:41:03

标签: iphone ios

我需要在UIViewController执行后选择Spash Screen。例如: Splash Screen执行后

if (condition) {
   call UIViewController2
}else{
   call UIViewController2
}

我在Programmatically set the initial view controller using Storyboards找到了正确的信息并且有效。谢谢大家

2 个答案:

答案 0 :(得分:0)

希望这有帮助

BOOL condition;

if(condition) {
   UIViewController2 *v2 = [[UIViewController2 alloc] init];

   [self presentingViewController:v2 completion:nil];  // iOS 6.0 +
   [self presentModalViewController:v2 animated:YES];  // iOS 2.0, but depreciated in iOS 6
}
else {
   // not fully sure what you're asking for this part, but do the same as above
   // if you're looking for the same view controller
}

答案 1 :(得分:0)

这可能会对您有所帮助:

在viewController.h中导入ViewController目标,并在storyboard中输入一个标识符:

  if(condition) {

   viewController1 *v1 = (viewController1 *)[self.storyboard instantiateViewControllerWithIdentifier:@"view1"];
   [self presentViewController:v1 animated:YES completion:nil];
  }

 else {

 // same code but with other viewController
 }