简体   繁体   English

启动画面,如水龙头报仇3

[英]splash screen like tap tap revenge 3

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. 我想向一个现有项目添加一个启动屏幕,类似于tap revenge3。它基本上显示一个屏幕2秒钟,然后显示2秒钟,然后立即显示菜单。

Can anyone tell me how i would be able to create something like that? 谁能告诉我我将如何创建类似的东西? thanks . 谢谢 。

Obviously opinions on splash screens vary. 显然,启动屏幕上的意见不尽相同。 However, to do what TTR does is pretty simple; 但是,要做TTR的工作非常简单; have a single Default.png file for your first screen. 第一个屏幕只有一个Default.png文件。 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. 在启动到applicationDidFinishLaunching:结束之间的所有操作都将在显示Default.png屏幕时完成。 Use -performSelector:withObject:afterDelay: to defer 'expensive' calls, so that you can quickly get to your second splash screen. 使用-performSelector:withObject:afterDelay:推迟“昂贵”的呼叫,以便您可以快速进入第二个启动屏幕。

its very simple. 它非常简单。 i've just accomplished this and it works exactly the same way that the tap tap revenge loading screen does. 我刚刚完成了此操作,它的工作方式与Tap Tap Revenge加载屏幕完全一样。

To load 2 different screens one after another before showing the main menu you do this. 要在显示主菜单之前一个接一个地加载2个不同的屏幕,请执行此操作。 1) create a nib file place a UIButton that covers the whole screen then connect it to an outlet. 1)创建一个nib文件,放置一个覆盖整个屏幕的UIButton,然后将其连接到插座。 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. 2)在viewDidLoad方法中,我确保将UIButton的图像背景属性设置为image1,然后在1.5秒后使用计时器将其更改为image2。

now the tap tap revenge loading screen allows you to skip those two loading screens by tapping on the screen. 现在,tap tap revenge加载屏幕允许您通过在屏幕上点击来跳过这两个加载屏幕。 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. 因此基本上可以创建一个函数,以便当用户在屏幕上点击时(本质上是一个巨大的按钮,它覆盖了屏幕的宽度和高度),它将变为UIButtons image background属性,变为image2。 If clicked again it would load a new nib file for the main menu. 如果再次单击它将为主菜单加载一个新的nib文件。 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. 因此,无论哪种方式,如果您不点击屏幕(uibutton),则由于计时器的原因,应用程序将显示image1,然后在1.5秒后将UIButton的图像自动更改为image2,然后在另外1.5秒(共3秒)后再次将其更改将加载mainMenuView nib文件。

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. 显然,当您单击按钮一次后,它应该更改为image2,但是当调用相同的函数时如何将图像更改为image2:我有一个计数器,当调用该函数时该计数器将递增1。 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. 因此在启动时该值将为0。因此,当用户点击按钮快速浏览加载屏幕时,该值将更改为1,图像将更改为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. 当用户再次单击该按钮以从image2跳到加载屏幕时,将调用相同的功能来更改图像,但将检查计数器以查看其值是否为1,如果它已经在image2上,则为然后只需加载屏幕即可。 its as simple as that. 就这么简单。 it works very well. 它工作得很好。 If there is an easier way to do this do let me know. 如果有更简便的方法,请告诉我。 thanks 谢谢

Pk PK

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM