views:

533

answers:

2

Hi, thank you for taking your time to read this message. I hope you are able to answer my question.

I would like to add a splash screen to an existing project similar to that of tap tap revenge 3. it basically shows one screen for 2 seconds then another for 2 seconds and then it just shows the menu straight away.

Can anyone tell me how i would be able to create something like that? thanks .

+2  A: 

Obviously opinions on splash screens vary. However, to do what TTR does is pretty simple; have a single Default.png file for your first screen. Then, make the top view controller you load at startup a simple image, and that's your second screen.

The trick is too offload as much of your startup code as possible, and defer it to after the initial launch. Anything done= between startup and the end of applicationDidFinishLaunching: will be done while your Default.png screen is shown. Use -performSelector:withObject:afterDelay: to defer 'expensive' calls, so that you can quickly get to your second splash screen.

Ben Gottlieb
James Thomson describes this approach here: http://www.dragthing.com/blog/?p=246
Brad Larson
A: 

its very simple. i've just accomplished this and it works exactly the same way that the tap tap revenge loading screen does.

To load 2 different screens one after another before showing the main menu you do this. 1) create a nib file place a UIButton that covers the whole screen then connect it to an outlet. 2) in the viewDidLoad method i made sure that the UIButton's image background property was set to image1 then after 1.5 seconds change it to image2 with a timer.

now the tap tap revenge loading screen allows you to skip those two loading screens by tapping on the screen. so basically create a function so that when the user taps on the screen (which essentially is a huge button that covers the width and height of the screen) it would change to UIButtons image background property to image2. If clicked again it would load a new nib file for the main menu. voila job done.

so either way if you dont tap on the screen (the uibutton) then because of the timer the application will show image1, then change the UIButton's image automatically to image2 after 1.5 seconds then again after another 1.5 seconds (3 seconds in total) the application would load the mainMenuView nib file.

obviously when you click the button once it should change to image2 but then how do you get the image to change to image2 when the same function is called: well i have a counter which will incremement in 1 when the function is called. so at startup that value would be 0. so when the user taps on the button to quikly skim past the loading screen the value would change to 1 and the image would change to image2.

when the user clicks on the button again to skip from image2 to the loading screen the same function would be called that changes the image but would check the counter to see if it is in value 1 and if it is then that its already on image2 so then just load the screen. its as simple as that. it works very well. If there is an easier way to do this do let me know. thanks

Pk

Pavan