장치 회전 제어
배경.
각 화면(ViewController)을 회전 제어하려는 경우
회전 가능한 모든 방향을 먼저 지정합니다.
UISupportedInterfaceOrientations
각
ViewController
shouldAutoroate, supportedInterfaceOrientations나는 단지 과속 제어를 어떻게 하는지 알 뿐이다.
나는 그다지 총명하지 않다고 생각해서 다른 방법을 찾았다.
회전 제어 방법
다음과 같이 각
ViewController
에 대해 회전을 제어할 수 있습니다.소스 코드
AppDelegate.swift
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> Int {
if window?.rootViewController?.presentedViewController is ViewController2 {
return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue)
} else {
return Int(UIInterfaceOrientationMask.Portrait.rawValue)
}
}
그러면 U I S u p o rted Interface Orientations는 무엇입니까?
UISupportedInterfaceOrientations
이 조사에 따르면 앱을 시작할 때 취할 수 있는 방향을 지정한 것으로 보인다.
Reference
이 문제에 관하여(장치 회전 제어), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/bolobob/items/725c7f2d43673d2682a3텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)