How to use dark mode in simulator iOS 13?

后端 未结 8 1866
迷失自我
迷失自我 2020-12-04 10:35

While I am developing the iOS app I need to test it in simulator with dark mode option so I can get more clarity about the app UI. But when I go to the Setting I am not gett

8条回答
  •  温柔的废话
    2020-12-04 11:12

    There are two ways to enable dark mode in Simulator. Note: Make sure that you’re using iOS 13 simulator. X-D

    Solution 1: Change build settings

    1. Open Settings app
    2. Select Developer
    3. Enable Dark appearance

    Solution 2: Programmatically

    Simply add this code block in your ViewController file.

    override func viewDidLoad() {
        super.viewDidLoad()
        #if DEBUG
        // This changes appearance only for debug mode
        overrideUserInterfaceStyle = .dark
        #endif
    }
    

    Check this apple docs for more details.

提交回复
热议问题