且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在TabBarController之前加载欢迎屏幕(启动屏幕)

更新时间:2023-12-06 16:45:52

正确的方法是正常加载标签栏应用程序,但使用标签栏控制器的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 YESes to NOs to avoid the slide-up-from-the-bottom animation.