在启动屏幕中禁用智能反转

在启动屏幕中禁用智能反转

本文介绍了在启动屏幕中禁用智能反转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用中,我有一个黑暗的启动屏幕,因此,我想为启动屏幕禁用智能"反转.
,我发现,在任何视图中,我都可以做到:

In my app, I have a dark launch screen and, hence, I would like to disable "smart" invert for the launch screen.
In a similar question, I found, that in any view, I can just do:

accessibilityIgnoresInvertColors = true

但是,我显然无法掌握启动屏幕的视图.
是否有一些隐藏的.plist设置,或者我可以采取的其他任何步骤?

However, I obviously cannot get a hold of my launch screen's view.
Is there some hidden .plist setting, or any other steps I can take?

推荐答案

在您的AppDelegate的willFinishLaunchingWithOptions中调用以下函数:

call below function in your willFinishLaunchingWithOptions of your AppDelegate :

func appAppearanceConfig(){
        NotificationCenter.default
            .addObserver(forName: UIAccessibility.invertColorsStatusDidChangeNotification,
                         object: nil,
                         queue: OperationQueue.main) {_ in
                            if UIAccessibility.isInvertColorsEnabled {
                                UIView.appearance().accessibilityIgnoresInvertColors = true
                            }
        }
    }

这篇关于在启动屏幕中禁用智能反转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 21:01