首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Everyplay支持iOS6中的景观吗?

Everyplay支持iOS6中的景观吗?
EN

Stack Overflow用户
提问于 2013-05-04 11:23:20
回答 2查看 560关注 0票数 2

我正在将Everyplay集成到我的Cocos2d Game.My游戏中,只支持横向。在iPad上一切都很顺利。但是当我在iPhone(iOS6)上测试时,当我调用"[Everyplay sharedInstance showEveryplay]“时抛出异常如下:原因:‘支持的方向与应用程序没有共同的方向,shouldAutorotate返回YES’

我知道定向机制在iOS6中发生了变化,所以我添加了这个方法:

代码语言:javascript
复制
-(BOOL)shouldAutorotate{
    return YES;
}
-(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;
}
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
        return UIInterfaceOrientationMaskAllButUpsideDown;
}

然后"[Everyplay sharedInstance showEveryplay]“无一例外地工作,但我的游戏也支持我不想要的肖像定向。

如果我只想在我的游戏中支持景观,但让"[Everyplay sharedInstance showEveryplay]“无一例外地工作,我该怎么办?

EN

回答 2

Stack Overflow用户

发布于 2013-08-13 14:06:11

您有两个选项来解决这个问题。

选项1:

添加UISupportedInterfaceOrientations数组到您的游戏的info.plist与项目UIInterfaceOrientationPortrait,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight和UIInterfaceOrientationPortraitUpsideDown。通过从项目摘要页面检查所有支持的接口方向或手动编辑info.plist文件,您可以在xCode中轻松完成此操作。

选项2:

将以下方法添加到应用程序的AppDelegate.m文件中:

代码语言:javascript
复制
// IOS 6

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
  return UIInterfaceOrientationMaskAll;
}

在这两种情况下,您还必须确保已将仅横向方向处理代码添加到游戏的主UIViewController中。

代码语言:javascript
复制
// IOS 5

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

// IOS 6

- (BOOL)shouldAutorotate {
   return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
  return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}
票数 2
EN

Stack Overflow用户

发布于 2013-05-13 18:40:18

在iPhone上,Everyplay webview总是处于纵向模式,但在iPad上,webview支持这两种模式。录制支持这两种模式,视频播放器也是如此。我们可能会在不久的将来更新景观模式的iPhone分辨率,但它将需要一些重新设计,才能完成这项任务。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16370261

复制
相关文章

相似问题

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