TabBarController之前的启动画面

TabBarController之前的启动画面

本文介绍了TabBarController之前的启动画面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iPhone开发人员的初学者,我正在开发我的第一个应用程序。实际上,我已经创建了一个Tab Bar应用程序,但我想在运行应用程序时添加启动画面。

I am a beginner of iPhone developer and I am working on my first apps. Actually, I already created a Tab Bar application well but I would like to add the Splash Screen when run the apps.

我在

但是当我尝试输入代码时,启动画面不会加载,只是继续显示我的tabbarcontroller。

But when I try to put in my code, the splash screen doesn't load and just keep showing my tabbarcontroller.

我创建了一个SplashViewController。 h,SplashViewController.m和SplashView.xib以下是我的代码,

I created a SplashViewController.h, SplashViewController.m and SplashView.xib and following is my code,

#import "SplashViewController.h"
...
...

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.
        SplashViewController *controller = [[SplashViewController alloc] initWithNibName:@"SplashView" bundle:nil];
        [self.tabBarController presentModalViewController:controller animated:YES];
        [controller release];
        // Add the tab bar controller's view to the window and display.
        [self.window addSubview:tabBarController.view];
        [self.window makeKeyAndVisible];

        return YES;
    }

应用运行没有错误但只是无法加载启动画面,任何评论都是非常感谢。谢谢!

The apps run without error but just cannot load the splash screen, any comment is highly appreciated. Thanks!

推荐答案

我的猜测是标签栏控制器忽略了你对 presentModalViewController的调用:动画: 因为它还没有出现在屏幕上。将标签栏视图添加为窗口的子视图后,尝试将呼叫移至。即使在调用 makeKeyAndVisible 之后,它也可能发生。

My guess is that the tab bar controller is ignoring your call to presentModalViewController:animated: because it isn't on screen yet. Try moving the call to after the tab bar view has been added as a subview to the window. It may have to happen even after the call to makeKeyAndVisible.

这篇关于TabBarController之前的启动画面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 04:52