https://qiita.com/koogawa/items/e0b3862c0fbdf97b579f
Can't I do this?
The screen brightness can be obtained as follows:
Objective-C
:
CGFloat brightness=[UISscreen mainScreen].brightness;
Returns a value between 0.0 and 1.0.The more numbers you have, the brighter it becomes.
By the way, this is the case for Swift
.
Swift
:
var brightness:CGFloat=UISscreen.main.brightness
Screen brightness = surrounding brightness, so if the brightness is high, it is possible to judge that the user is in a bright place.
However, some users have fixed screen brightness, so this standard is not always true.
That's right.
© 2024 OneMinuteCode. All rights reserved.