首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >cocos2d与cocosbuilder景观定位

cocos2d与cocosbuilder景观定位
EN

Stack Overflow用户
提问于 2013-03-14 15:21:47
回答 1查看 285关注 0票数 0

当我与cocos2d和cocosbuilder一起工作时,我遇到了景观旋转的问题。

我在我的协同构建器项目和xcode 支持的接口方向(iPhone Suported Orientations )上都有iPhone、景观iPhone5 ,我只选择了景观。

在我的代理上。我有:

代码语言:javascript
复制
-(NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskLandscape;
}

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

这应该很简单,但是我在这里很困难,而且不想在不使用cocosbuilder的情况下重新组装游戏。

EN

回答 1

Stack Overflow用户

发布于 2013-03-14 15:27:13

如果您支持最新版本的iOS,而这些版本现在主要使用,那么您应该使用这些方法来检查方向。

代码语言:javascript
复制
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeLeft;
}


-(NSUInteger)supportedInterfaceOrientations

{
       return UIInterfaceOrientationMaskLandscape;
}


-(BOOL)shouldAutorotate {


        return YES;    
}

shouldAutorotateToInterfaceOrientation在iOS6中是不推荐的,而不是使用这个方法,而是使用我提供的上述方法,并在那里阅读苹果提供的UIViewController文档,它清楚地说明了您可以使用哪些方法,以及用于什么目的。以下是您可能使用的一些方法

代码语言:javascript
复制
willRotateToInterfaceOrientation:duration: 
willAnimateRotationToInterfaceOrientation:duration:
and didRotateFromInterfaceOrientation:
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15413287

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档