Jimmy's iOS
iOS) 다크모드 & 라이트 모드 막기 본문
다크모드와 라이트모드 , 둘 중 한가지만 지원되도록 하고 싶다면 window 를 설정해줄때 overrideUserInterfaceStyle 에서 설정을 주면 됩니다.
- window?.overrideUserInterfaceStyle = .light
- window?.overrideUserInterfaceStyle = .dark
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let scene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: scene)
window?.rootViewController = ViewController()
window?.backgroundColor = .white
window?.overrideUserInterfaceStyle = .light // 라이트모드만 지원
// window?.overrideUserInterfaceStyle = .dark // 다크모드만 지원
window?.makeKeyAndVisible()
}
}
'iOS' 카테고리의 다른 글
iOS) Alamofire 을 이용한 HTTP 통신 알아보기 (0) | 2021.11.03 |
---|---|
iOS) URLSession 에 대해 알아보자 (0) | 2021.10.31 |
iOS) UINavigationController 왼쪽 스크롤 제스쳐로 팝업 구현 (0) | 2021.09.27 |
iOS) Lottie-Animation 적용하기 (0) | 2021.09.22 |
iOS) 앱 최신버전 체크 및 업데이트 하러 가기 (0) | 2021.09.14 |