我正在尝试将游戏中心集成到我的游戏中。
因此,我从游戏中心收到了视图控制器,并介绍了它。
我的游戏只是景观,但是当我启动游戏中心时,游戏中心登录将在肖像中。 我的游戏的ViewController具有 supportEdorientations 和 preferredorecrientation 仅返回 landscape 和 shordautorAtate strong>信息clist Countains也只有景观。
当我在Xcode控制台中打印时,我从GameCenter那里收到的视图controller的偏爱方向,它说肖像。
这仅在发布时才发生,并且仅在iOS 8:游戏是景观上,gamecenter是肖像,是肖像,将Infoplist和Game ViewController的方向放置只是景观。
我希望我的游戏录入器也是景观,并且我尝试使用:
**
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
**
它起作用,但由于苹果会迫使方向而被苹果拒绝。
我还尝试使用 modalPresentationStyle 设置为 uimodalPresentationCurrentContext >,但它不起作用。
还有更多想法吗?请,我绝望:P
就我而言,这就是我解决这个问题的方式:
gcLoginViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
gcloginviewController是您在LocalPlayer的AuthenticateHandler中收到的UiviewController。我还确保在应用程序的委托中仅返回景观中的支持的Interfaceorientationsforwindow 。iOS 8.1.1&8.1.2在2个不同的设备上。