views:

45

answers:

0

Cocos2d version: v0.99.04

I'm adding Game Center to my current application and I found some code to open up the GKMatchmakerViewController. It seems to work well, except when it gets dismissed it changes the orientation in the simulator to portrait. The game only runs in landscape. I rotate the device back to landscape and all the cocos2d scenes still work fine, but if I open up an alert or peer picker, they open in portrait mode. I can open and close scenes, but they will now all display this behavior. This happens using an actual device also.

// *.h
UIViewController *tempVC;

// *.m

// Open

GKMatchRequest *request = [[[GKMatchRequest alloc] init] autorelease];
request.minPlayers = 2;
request.maxPlayers = 2;

GKMatchmakerViewController *mmvc = [[[GKMatchmakerViewController alloc] initWithMatchRequest:request] autorelease];
mmvc.matchmakerDelegate = self;

tempVC=[[UIViewController alloc] init];
[[[CCDirector sharedDirector] openGLView] addSubview:tempVC.view];
[tempVC presentModalViewController: mmvc animated: YES];    

// Close

[tempVC dismissModalViewControllerAnimated:YES];
[tempVC.view removeFromSuperview];
[tempVC release];

As soon as I hit the dismissModalViewControllerAnimated, that's when the simulator rotates.

Thanks in advance for any help.