在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屋!