iOS/Swift
[Swift] 앱의 화면 회전 제어
제이널
2021. 9. 30. 16:54
목차
1. 개요
2. 구현
1. 개요
프로그래밍적으로 아이폰 또는 아이패드임을 인지해서 각각의 화면 회전을 제어해줄 수 있다.
if (UIDevice.current.userInterfaceIdiom == .pad 또는 .phone ) { ... }
하지만 코드의 복잡성이 늘기 때문에, 좀 더 간단한 방법을 찾게 되었고
Info.plist에서 간단히 해결할 수 있다는 걸 알게 되었다.
2. 구현
먼저, Xcode의 Info.plist에 아래의 키들을 추가해야 한다.
1. Supported interface orientations
2. Supported interface orientations (iPad)
3. Supported interface orientations (iPhone)