Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
504 views
in Technique[技术] by (71.8m points)

ios - Loading a Welcome Screen (Splash Screen) before TabBarController

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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];

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...