【问题标题】:possible to default an ios app to a certain background brightness?可以将 ios 应用程序默认为特定背景亮度吗?
【发布时间】:2019-01-07 19:40:59
【问题描述】:

我正在尝试将 ios 应用程序在打开时默认设置为特定亮度。这可能吗?如果是,我需要使用哪些软件包?

如果无法做到这一点,我可以在应用程序本身内设置亮度滚动条吗?

谢谢!

【问题讨论】:

标签: ios swift brightness


【解决方案1】:

要设置屏幕亮度,试试这个代码

UIScreen.main.brightness = CGFloat(0.5)

【讨论】:

    【解决方案2】:

    你可以查看this的文章。

    import UIKit
    extension UIScreen
    {
        static func setMainBrightness(brightness: CGFloat)
        {
            guard (0...1).contains(brightness) else
            {
                print("Attempt to set the screen brightness to an invalid value: \(brightness) should be between 0 and 1 inclusive.")
                return
            }
            self.main.brightness = brightness
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-18
      相关资源
      最近更新 更多