Ios 如何在AppDelegate外部使用UINavigationController?
在我当前的应用程序中,我使用UINavigationController显示其他ViewController的内容。它是这样安装在appDelegate中的Ios 如何在AppDelegate外部使用UINavigationController?,ios,uinavigationcontroller,splash-screen,Ios,Uinavigationcontroller,Splash Screen,在我当前的应用程序中,我使用UINavigationController显示其他ViewController的内容。它是这样安装在appDelegate中的 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen
- (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。这意味着我会在我的另一个ViewController中进行设置,对吗
可能吗?有什么帮助吗?
谢谢你的时间。你可以像我下面做的那样做
- (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方法,谢谢您的快速回复。我还发现了一篇关于闪屏的有趣博客:
-(void)Load_FirstView
{
MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
[self.window makeKeyAndVisible];
}
对我来说,这是可行的。看起来,这是一种很好的灵活方式