2009-09-19 5 views
3

Lorsque j'essaie d'utiliser UIView avec cocos2d j'ai un problème. Je crée UIViewController, ajouter en vue de et ajouter en vue de la fenêtre:Cocos2d vs UIKit

helpController=[[HelpController alloc] init]; 
helpController.view=view; 
[[[[Director sharedDirector] openGLView] window] addSubview: helpController.view]; 

@interface HelpController : UIViewController 
{ 
} 
@end 
@implementation HelpController 
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 
return YES; 
} 
@end 

Ceci est fonction supprimer vue depuis la fenêtre et exécuter une autre scène cocos:

-(void)back:(id)sender { 
FadeTransition *tran=[FadeTransition transitionWithDuration:0.5f scene:[MainMenuScene node]]; 
[helpController.view removeFromSuperview]; 
[[Director sharedDirector] replaceScene:tran]; 

} 

Première fois: http://tinyurl.com/nu98ub

L'orientation de l'écran est UIInterfaceOrientationLandscapeRight. La première fois que je lance une scène avec cette vue, cette orientation de la vue est Paysage, mais la prochaine fois c'est Portrait, je ne peux pas résoudre ce problème. Quelqu'un m'aider, s'il vous plaît :)

+0

C'est la prochaine fois: http://tinyurl.com/myk3yw –

Répondre