Cocos2d How to make image loading longer?

I want my game to load an image longer (Default.png), how?

+4
source share
2 answers

What you can do, since your application has completed the launch method, you can use NSThread to sleep for a time interval of 2 seconds.

Like this

-(void)applicationDidFinishLaunching { [NSThread sleepForTimeInterval:2.0f]; } 

But if you want to do some work behind the point, than you can send a custom queue to do the job using Grand Central Dispatch.

Check the documentation on it.

+7
source

In Appdelegate:

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { sleep (3); // Override point for customization after application launch. // Add the view controller view to the window and display. [self.window addSubview:viewController.view]; [self.window makeKeyAndVisible]; return YES; } 

sleep (3); means that the loading screen (Default.png) will load / sleep for 3 seconds.
So in fact you just need to put the right seconds in ().
For example, 5 sec: sleep (5);

0
source

Source: https://habr.com/ru/post/1344348/


All Articles