سؤال

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];

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: dark

0.3: light

0.4: dark

0.5: dark

0.6: light

0.7: dark

0.8: dark

0.9: dark

1.0: dark

1.1: dark

1.2: light

1.3: dark

1.4: dark

1.5: light

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top