Swift sprite kit landscape only forced into portrait

天大地大妈咪最大 提交于 2020-01-06 02:13:53

问题


I have asked this question before but maybe due to my bad explanation unfortunatly I did not get a reply. I am still having the issue with my spritekit game that is in landscape only.

When I lock my device or sometimes just switch to another portrait app, and than return to my game it is forced into portrait mode for 1-2 secs. This does not happen with other games and I do not understand what I am doing wrong. I have set orientation to landscape left and right only (in Targets-General), changed the orientation settings in GameViewController.swift and also changed the Info.plist settings for "supported interface orientation" to make sure it is only landscape left and right.

What am I missing? I would appreciate any replies. Thank you very much


回答1:


So it turns out after ages of research that it is the iAd Banners that cause this issue. To fix it simply remove them from the superView in AppDelegate when application "WillResignActive" and reload them when application "WillEnterForeground".

Credits goes to Iganton

Background app screenshot showing wrong orientation after double tapping home



来源:https://stackoverflow.com/questions/31230280/swift-sprite-kit-landscape-only-forced-into-portrait

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!