0
가로 모드에서 비디오 게임을하고 있습니다. 그리고 장치 방향이 바뀌면보기는 landscapeLeft와 landscapeRight 사이에서만 회전합니다. 즉, 영화를 재생할 때 인물 모드가없는 것입니다. 영화보기와 별개로, 다른보기는 포틀 트림 모드이므로 앱 구성이 세로입니다. 동영상보기를 가로 모드로만 회전하려면 어떻게해야합니까?landscapeLeft와 landscapeRight 사이에서만 회전하십시오.
여기 내 코드의 일부입니다.
AppDelegate에,
internal var shouldRotate = false
func application(_ application: UIApplication,
supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return shouldRotate ? .allButUpsideDown : .portrait
}
영화보기 제어기
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.shouldRotate = true // or false to disable rotation
let value = UIInterfaceOrientation.landscapeLeft.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
은 지금 문제가 영화보기를 할 때 방향을 변경 protrait 될 수 있다는 것이다.