【问题标题】:Cocos2d vs UIKitCocos2d 与 UIKit
【发布时间】:2009-09-19 07:50:24
【问题描述】:

当我尝试将 UIView 与 cocos2d 一起使用时,我遇到了问题。 我创建 UIViewController,为其添加视图并将视图添加到窗口:

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

这是从窗口中移除视图并运行其他 cocos 场景的功能:

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

}

第一次: http://tinyurl.com/nu98ub

屏幕方向是 UIInterfaceOrientationLandscapeRight。 然后我第一次用这个视图运行场景,这个视图方向是横向,但下一次是纵向,我无法解决这个问题。有人帮助我,请:)

【问题讨论】:

标签: iphone uikit cocos2d-iphone


【解决方案1】:

这个网址 http://www.cocos2d-iphone.org/wiki/doku.php/tips:cocos2d_and_uikitlayer 包含一个仅解决您的问题的类。 不完全是一个及时的答案,但希望能有所帮助

【讨论】:

    猜你喜欢
    • 2011-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多