我正在尝试将游戏中心整合到我的游戏中。
So I receive the the viewcontroller from the game center and I present it. 我的游戏只是风景,但当我启动游戏,游戏中心登录是在肖像。我的游戏的视图控制器有supportedOrientations和preferredOrientation,只返回景物,和shouldAutorotate被设置为是;信息plist也只返回景观。
当我在xCode控制台中打印我从gamecenter接收到的视图控制器的首选方向时,上面写着肖像。
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也是景观,我尝试使用:
**
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];**
这是可行的,但它会被苹果公司拒绝,因为它强制了方向。
I've also tryed using **modalPresentationStyle** setted to **UIModalPresentationCurrentContext** but it didn't work. 还有其他想法吗?求你了,我绝望了
发布于 2015-05-13 13:14:29
就我而言,我就是这样解决这个问题的:
gcLoginViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;gcLoginViewController是在localPlayer的authenticateHandler中接收到的UIViewController。我还确保应用程序的委托中的supportedInterfaceOrientationsForWindow只返回景观。在两种不同的设备上,它在ios 8.1.1和8.1.2上工作得很好。
https://stackoverflow.com/questions/30165261
复制相似问题