I am using Facebook SDK in my game in order to post some scores on Facebook. My code is using the Cocos2D framework so I had to add some code to enable the use of UIView. Everything works fine except that the view appears in portrait orientation despite the fact that my nibs attributes indicate landscape, the ShouldautoRotate method returns landscape, and the app orientation is also the to landscape. here is the code that set up the view:
// share to facebook methods
-(void)shareFacebookSelected
{
[[SimpleAudioEngine sharedEngine]stopBackgroundMusic];
[[CCDirector sharedDirector] pause];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
myViewController1 = [[HFViewController alloc] initWithNibName:@"HFViewController_iPhone" bundle:nil];
} else {
myViewController1 = [[HFViewController alloc] initWithNibName:@"HFViewController_iPad" bundle:nil];
}
UIWindow* window = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.75];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:window cache:YES];
[[[CCDirector sharedDirector]view] removeFromSuperview];
myViewController1.view.hidden = false;
[window addSubview:myViewController1.view];
[UIView commitAnimations];
}
I also enabled a button to return to the normal cocos game and remove the UIView but upon return even my main game orientation has changed to portrait.
any ideas???