在 TabBarController 之前加载欢迎屏幕(启动画面) [英] Loading a Welcome Screen (Splash Screen) before TabBarController
问题描述
在我的基于 TabBar 的 iPhone 应用程序中,我想在实际应用程序加载之前显示一个全屏欢迎页面(带有一些日志),如何从 xib 文件加载 UIView 作为欢迎屏幕,然后从那里我可以加载我的基于 TabBar 的应用程序.
In my TabBar based iPhone application, I would like to display a full screen welcome page (with some logs) before the actual application loads, How can I load a UIView from xib file as the welcome screen and then from there I can load my TabBar based application.
推荐答案
正确的方法是正常加载标签栏应用程序,但使用presentModalViewController:animated:
方法标签栏控制器以在其上显示视图控制器(在 application:didFinishLaunching:
中):
The right way to do this would be to load your tab bar application normally, but use the presentModalViewController:animated:
method of the tab bar controller to display a view controller over it (in application:didFinishLaunching:
):
SplashScreenController *controller = [[SplashScreenController alloc] initWithNibNamed:nil bundle:nil];
[self.tabBarController presentModalViewController:controller animated:YES];
[controller release];
我通常会在启动画面上放置一个关闭"按钮,但您也可以这样做:
I'll usually put a "dismiss" button on the splash screen, but you could also do something like this:
[self.tabBarController performSelector:@selector(dismissModalViewControllerAnimated:) withObject:YES afterDelay:2.0];
它将在启动时呈现视图控制器并在两秒后关闭它.将 YES
es 更改为 NO
s 以避免从底部向上滑动动画.
which will present the view controller at launch and dismiss it after two seconds. Change the YES
es to NO
s to avoid the slide-up-from-the-bottom animation.
这篇关于在 TabBarController 之前加载欢迎屏幕(启动画面)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!