2017-12-19 1 views
0

모두. SpriteKit을 사용하여 Xcode 9 및 빠른 4로 응용 프로그램을 만들고 있는데 게임을 가로 모드로 설정하고 싶습니다.SpriteKit 가로 방향이 작동하지 않습니다.

프리젠 테이션 만 허용하도록 프로젝트 설정에서 설정을 시도하고이 코드를 앱 델리게이트 파일에 추가했습니다.

func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { 
    //make device portrait unless it is the game view controller 
    if self.window?.rootViewController?.presentedViewController is GameViewController { 

     return UIInterfaceOrientationMask.landscape; 

    } else { 
     return UIInterfaceOrientationMask.portrait; 
    } 
} 

그러나 둘 다 작동하지 않는 SpriteKit 장면은 여전히 ​​세로로로드됩니다. 장면을 가로로로드하려면 어떻게해야합니까?

답변

0

프로젝트의 info.plist로 이동하면 하단의 "지원되는 인터페이스 방향"과 "지원되는 인터페이스 방향 (iPad)"의 두 요소가 있어야합니다. 드롭 다운을 클릭하고 두 요소에서 세로 모드 방향을 제거합니다.

+0

게임 장면이 여전히 작동하지 않습니다. –

+0

은 세로로로드 된 장면이거나 장면 크기의 세로이지만 크기가 이상합니다 – Knight0fDragon

관련 문제