在我当前的应用程序中,我使用UINavigationController来显示其他viewControllers的内容。它就像这样安装在appDelegate中。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] init];
UINavigationController* navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
[navigationController.navigationBar setBarStyle:UIBarStyleBlackOpaque];
[self.window addSubview:navigationController.view];
[[self window] setRootViewController:navigationController];
[self.window makeKeyAndVisible];
return YES;
}
我现在想要的是创建一个新的视图控制器,它在启动画面后立即显示一个介绍视频。视频播放完成后,我想按下“StartViewController”并在其上安装UINavigationController。这意味着我会在我的其他一个ViewControllers中设置,对吧?
这可能吗?对此有何帮助? 谢谢你的时间。
答案 0 :(得分:0)
你可以像我在下面那样做
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
capturedImg = [[UIImage alloc]init];
self.splash = [[UIImageView alloc] initWithFrame:self.window.frame];
splash.image = [UIImage imageNamed:@"default.png"];
[self.window addSubview:splash];
[self performSelector:@selector(Load_FirstView) withObject:nil afterDelay:2];
[self.window makeKeyAndVisible];
}
和Load_FirstView方法
-(void)Load_FirstView
{
MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
[self.window makeKeyAndVisible];
}
如果你想要显示视频只需要放一个其他方法并将它放在这两个方法之间,即先调用它然后再调用它调用Load_firstView方法
答案 1 :(得分:0)
感谢您的快速回复。我刚刚发现了一个关于启动画面的有趣博客:
http://lucas.tiz.ma/blog/2011/09/26/ios-splash-screens-done-right/
对我来说,这种方式有效。看起来,这是一种很好的灵活方式。