首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iOS 8游戏中心LogIn定位

iOS 8游戏中心LogIn定位
EN

Stack Overflow用户
提问于 2015-05-11 10:25:20
回答 1查看 288关注 0票数 0

我正在尝试将游戏中心整合到我的游戏中。

代码语言:javascript
复制
So I receive the the viewcontroller from the game center and I present it. 

我的游戏只是风景,但当我启动游戏,游戏中心登录是在肖像。我的游戏的视图控制器有supportedOrientationspreferredOrientation,只返回景物,shouldAutorotate被设置为是;信息plist也只返回景观。

当我在xCode控制台中打印我从gamecenter接收到的视图控制器的首选方向时,上面写着肖像。

代码语言:javascript
复制
This happens only at launch and only on iOS 8: game is landscape, gamecenter is portrait, dispite the fact that infoplist and game viewcontroller's orientation is only landscape.  

我希望我的GameCenter也是景观,我尝试使用:

**

代码语言:javascript
复制
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];

**

这是可行的,但它会被苹果公司拒绝,因为它强制了方向。

代码语言:javascript
复制
I've also tryed using **modalPresentationStyle** setted to **UIModalPresentationCurrentContext** but it didn't work.  

还有其他想法吗?求你了,我绝望了

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-13 13:14:29

就我而言,我就是这样解决这个问题的:

代码语言:javascript
复制
gcLoginViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;

gcLoginViewController是在localPlayer的authenticateHandler中接收到的UIViewController。我还确保应用程序的委托中的supportedInterfaceOrientationsForWindow只返回景观。在两种不同的设备上,它在ios 8.1.1和8.1.2上工作得很好。

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

https://stackoverflow.com/questions/30165261

复制
相关文章

相似问题

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