iPhone亮度私有API无法正常工作 [英] iPhone brightness private API not working properly

查看:130
本文介绍了iPhone亮度私有API无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置背光的亮度,但它的表现非常奇怪。我正在使用私有API:

I am trying to set the brightness of the backlight, but it's acting very strangely. I am using the private API:

[(id)[UIApplication sharedApplication] setBacklightLevel:1.0f];

[(id)[UIApplication sharedApplication] setBacklightLevel:1.0f];

但是,当我打电话给这个时,屏幕会变暗,而不是像我想象的那样变得100%明亮。我用各种数字测试了这个,这就是我得到的:

However, when I call this, the screen dims, not becoming 100% bright like I thought it would. I have tested this with a variety of numbers, and here is what I got:

0.2:黑暗

0.3:光

0.4:黑暗

0.5:黑暗

0.6:光

0.7:黑暗

0.8:黑暗

0.9:黑暗

1.0:黑暗

1.1:黑暗

1.2:光

1.3:黑暗

1.4:黑暗

1.5:光

有些值比最暗的值略亮,但这是整体趋势。这种模式似乎没有任何意义。有谁知道亮度的大小应该是什么?

Some of the values were slightly brighter than the darkest values, but that is the overall trend. It doesn't seem like the pattern makes any sense. Does anyone know what scale the brightness should be on?

推荐答案

问题是编译器不知道方法需要一个浮动,除非你声明它。因此,传入的float将在传递时转换为另一种类型,然后通过该方法将该新位模式重新解释为float。你只需要在文件知道的头文件中声明方法,并且float将不加改变地传递。

The problem is that the compiler doesn't know a method takes a float unless you declare it. So the float you pass in is getting converted to another type when you pass it and then that new bit pattern being reinterpreted as a float by the method. You just need to have the method declared in a header that file knows about and the float will be passed unaltered.

这篇关于iPhone亮度私有API无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆