tvos10

How to check if Dark Appearance is enabled tvOS

烂漫一生 提交于 2020-01-02 07:58:13
问题 How do I check if a user has enabled Dark Appearance on their Apple TV? 回答1: Using UIUserInterfaceStyle, first available in tvOS 10, we can check what appearance the user has set. For example: func checkInterfaceStyle() { guard(traitCollection.responds(to: #selector(getter: UITraitCollection.userInterfaceStyle))) else { return } let style = traitCollection.userInterfaceStyle switch style { case .light: print("light") case .dark: print("dark") case .unspecified: print("unspecified") } } Also,

How to check if Dark Appearance is enabled tvOS

大兔子大兔子 提交于 2020-01-02 07:58:06
问题 How do I check if a user has enabled Dark Appearance on their Apple TV? 回答1: Using UIUserInterfaceStyle, first available in tvOS 10, we can check what appearance the user has set. For example: func checkInterfaceStyle() { guard(traitCollection.responds(to: #selector(getter: UITraitCollection.userInterfaceStyle))) else { return } let style = traitCollection.userInterfaceStyle switch style { case .light: print("light") case .dark: print("dark") case .unspecified: print("unspecified") } } Also,