在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:
方法在其上显示一个视图控制器(在应用程序: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更改为否
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屋!