2013-03-14 85 views
0

即时通讯工具与cocos2d和cocosbuilder一起使用时存在风景旋转问题。cocos2d和cocosbuilder风景取向

iPhone景观和我cocosbuilder项目 而在Xcode的我只有选择景观界面支载取向iPhone5的景观

我appDelegate.mi

有:

-(NSUInteger)supportedInterfaceOrientations { 

    return UIInterfaceOrientationMaskLandscape; 
} 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 

这应该是很简单,但有一个困难时期我在这里,真的不想,而无需使用cocosbuilder

再重新组装我的游戏
+0

您使用的是哪个版本的ios? – nsgulliver 2013-03-14 15:24:07

+0

我正在使用ios/xcode和cocos的最新版本 – 2013-03-14 15:31:52

回答

1

如果要支持它主要用于这些天的iOS的最新版本,那么你应该使用这些方法来检查取向

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation 
{ 
    return UIInterfaceOrientationLandscapeLeft; 
} 


-(NSUInteger)supportedInterfaceOrientations 

{ 
     return UIInterfaceOrientationMaskLandscape; 
} 


-(BOOL)shouldAutorotate { 


     return YES;  
} 

shouldAutorotateToInterfaceOrientation在iOS6中已弃用,而不是使用此方法,而是使用我提供的上述方法并阅读由苹果提供的UIViewController文档,其中明确写明了您可以使用哪些方法以及用于何种目的。以下是您可能使用的一些方法

willRotateToInterfaceOrientation:duration: 
willAnimateRotationToInterfaceOrientation:duration: 
and didRotateFromInterfaceOrientation: 
+0

您认为这可能是cocosbuilder上的一个错误?因为没有工作 – 2013-03-14 15:32:17

+0

你使用的是iOS6,所以不赞成使用的方法在你的应用程序中不起作用,请检查我的更新在回答 – nsgulliver 2013-03-14 15:45:11

+0

它不起作用..什么困扰我是,它的工作原理,如果我不使用cocosbuilder,但如果我使用ccbi,它不起作用。 – 2013-03-14 15:51:36