Detecting iOS Dark Mode Change

后端 未结 6 1736
悲哀的现实
悲哀的现实 2020-12-14 16:19

I read through the documentation regarding: https://developer.apple.com/documentation/appkit/supporting_dark_mode_in_your_interface

When the user chan

6条回答
  •  难免孤独
    2020-12-14 16:50

    Objective-C version:

    if (@available(iOS 12.0, *)) {
    
        if( self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark ){
           //is dark
        }else{
            //is light
    
        }
    }
    

提交回复
热议问题