读取iPhone的环境光传感器 [英] Reading the iPhone's Ambient Light sensor
问题描述
我在iPhone上注意到,在阳光直射几秒钟后,屏幕会调整为变亮,变暗等.我在想是否可以与该传感器进行交互?
I notice on my iPhone, after a few seconds of being in direct sun light, the screen will adjust to become brighter, dimmer etc. I was wondering if there was a way to interact with this sensor?
我有一个在外面使用的应用程序.当您进入直射光下时,在调整之前,很难看到屏幕上的一些弯折.即使那样,它也不总是像我想要的那样明亮.我想在户外观看时使用高对比度的皮肤,而在室内观看时使用低对比度的皮肤.
I have an application which is used outside. When you go into direct light, it becomes very difficult to see the screen for a few momments, before it adjusts. And even then, it's not always as bright as I'd like it to be. I would like to implement a high contrast skin for outdoor viewing, and a low contrast for indoor viewing.
是否可以读取光传感器数据,如果可以,如何提取这些传感器值?
Is this possible to read light sensor data, and if so, how do I extract these sensor values?
但是我认为有一个光传感器,因为相机知道何时使用闪光灯.
I would assume there is a light sensor however, as the camera knows when to use the flash.
推荐答案
尝试使用需要<GraphicsServices/GraphicsServices.h>
的GSEventSetBacklightLevel();
.这就是可以通过编程方式调整亮度级别的方式.还有一个get
选项,所以我认为可能包含您所需要的信息.
Try using GSEventSetBacklightLevel();
, which requires <GraphicsServices/GraphicsServices.h>
. This is how one can programmatically adjust the brightness levels. There is also a get
option, so I think that may have the information you're after.
这篇关于读取iPhone的环境光传感器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!