开发者

cocos2d how to make loading image last longer?

开发者 https://www.devze.com 2023-02-18 00:04 出处:网络
i want to make my game loading image last longer开发者_开发知识库(Default.png), how?What you can do is, in your application did finish launching method you can use NSThread to sleep for time interval

i want to make my game loading image last longer开发者_开发知识库(Default.png), how?


What you can do is, in your application did finish launching method you can use NSThread to sleep for time interval of 2 sec.

Like this

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

But if you want to do some work behind the sense than you can dispatch a custom queue to get the work done using Grand Central Dispatch.

Check the apple documentation on it.


In the Appdelegate :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

sleep (3);

// Override point for customization after application launch.

// Add the view controller's view to the window and display.
[self.window addSubview:viewController.view];
[self.window makeKeyAndVisible];

return YES;
}

The sleep (3); means that the loading screen (Default.png) will load/sleep for 3 seconds.
So actually you just have to put the seconds you want in the ().
For example 5 sec : sleep(5);

0

精彩评论

暂无评论...
验证码 换一张
取 消