When I try to use UIView with cocos2d I have a problem. I create UIViewController, add view to it and add view to window:
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
This is function that remove view from window and run other cocos scene:
-(void)back:(id)sender {
FadeTransition *tran=[FadeTransition transitionWithDuration:0.5f scene:[MainMenuScene node]];
[helpController.view removeFromSuperview];
[[Director sharedDirector] replaceScene:tran];
}
First time: http://tinyurl.com/nu98ub
The screen orientation is UIInterfaceOrientationLandscapeRight. First time then I run scene with this view, this view orientation is Landscape, but next times is Portrait, I can't resolve this problem. Somebody help me, please :)