Rizki
Rizki

Reputation: 281

How to show modal in cocos2d game application?

I want to know how to show modal view in cocos2d? Any one can help me?

Thanks before. Regards. :)

Upvotes: 0

Views: 1200

Answers (1)

Bongeh
Bongeh

Reputation: 2300

I use this code for presenting a GKLeaderboard within cocos2d.

    GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];

    UIViewController *container = [[UIViewController alloc] init];
    [container setView:[[CCDirector sharedDirector] openGLView]]; 
    [container setModalTransitionStyle: UIModalTransitionStyleCoverVertical];

    leaderboardController.leaderboardDelegate = container;

    [container presentModalViewController: leaderboardController animated: YES];

This will do what you want. Don't forget you need to release the UI objects when your done with them.

Upvotes: 1

Related Questions