How to make the scene1 load only one time


(wangwz) #1

For example, the guide page on the app which only needs to be displayed for the first time.
Sorry, my English is very poor.


(Mark Hunte) #2

Hi,

When you say app, what type of app…

iOS,
web browser
Mac Os

If it is either iOS or Mac Os i.e using Xcode to build the app. Then I would try and use two projects one with the main scenes and one with the guide page. Then use the NSUserDefaults API and the registerDefaults to do what you want.
i.e your registerDefaults.plist has the basic settings.

You check for a entry for ‘guideShown’ = true.
If it does not exist then you are looking at registerDefaults which means you need to show the guide Scene and add the ‘guideShown’ = true. to the User Defaults.

The next time the app launches the ‘guideShown’ = true will exist, which means we are now using the User Defaults. And you can go straight to the other scenes.

If you are talking about a browser app then you may want to look at localStorage.


(wangwz) #3

thank you
So, I hope that some of the elements on the page only show when the first open,Click the close button to open the next time not show


(Mark Hunte) #4

Pretty much.

I should add you can do all this with localStorage. for the project for iOS and Mac OS. and not use the NSUserDefaults API at all.