Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- Git
- MacOS
- Notification
- Firebase
- iOS16
- error
- 한글
- 개발자
- Xcode
- github
- Apple
- Swift
- window
- IOS
- Code
- Realm
- FLUTTER
- darkmode
- UIButton
- SwiftUI
- Archive
- view
- mac
- geofencing
- appstore
- 이미지
- Session
- rxswift
- 웹뷰
- JPA
Archives
- Today
- Total
EEYatHo 앱 깎는 이야기
Swift ) iOS16 강제 화면 회전 대응 - EEYatHo iOS 본문
반응형
Scene의 화면회전 제어 로직이 변경되면서,
기존에 사용하던 UIDevice 방식은 deprecated 되었다.
// is deprecated
let value = UIInterfaceOrientation.landscapeRight.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
해당 방식으로 강제 화면 회전시, 친절하게 아래와 같은 에러가 발생한다.
( UIWindowScene.requestGeometryUpdate 를 사용해달라는 말. )
새로 사용해야 될 함수 :
적용 코드 :
/// 화면 가로로 바꾸기
if #available(iOS 16.0, *) {
let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
windowScene?.requestGeometryUpdate(.iOS(interfaceOrientations: .landscapeRight))
} else {
let value = UIInterfaceOrientation.landscapeRight.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
}
'iOS, Swift > Tip, Bug, Swift Error' 카테고리의 다른 글
iOS ) iOS16 present 버그 - EEYatHo iOS (2) | 2022.10.11 |
---|---|
iOS ) Archive 후 Appstore Uplaod 시 에러 - EEYatHo iOS (0) | 2022.10.04 |
Swift ) iOS16 네비게이션바 변경사항 - EEYatHo iOS (0) | 2022.09.15 |
iOS ) 이미지는 알파 채널 또는 투명도를 포함할 수 없습니다. - EEYatHo iOS (0) | 2022.05.31 |
Swift ) disable tintColor - EEYatHo iOS (0) | 2022.05.01 |
Comments