-2

I use this code to change the iPhone screen brightness:

- (void)setLightValue:(CGFloat)lightValue
{
    [UIScreen mainScreen].brightness = lightValue ;
}

However this code doesn't call the brightness UI of the iPhone screen.

I want something like this to appear on brightness change: Please refer to the following picture

Hamish
  • 78,605
  • 19
  • 187
  • 280
user5465320
  • 719
  • 2
  • 7
  • 15
  • I am not familiar with any public API which can manage this behavior – Martin Makarsky Jan 17 '16 at 14:36
  • 1
    iOS doesn't have a system brightness UI (the image you attatched is the OSX brightness UI)... you'd have to make your own for iOS – Hamish Jan 17 '16 at 14:40
  • What *"brightness UI of the iPhone screen"*? – luk2302 Jan 17 '16 at 14:44
  • No ! In China , many iOS app have this function and they can call iPhone System brightness UI . the code "[UIScreen mainScreen].brightness = lightValue" can change System brightness but cannot call UI . I want to call the UI . – user5465320 Jan 17 '16 at 14:49
  • I don't think there's any public method that can do that through the SDK (look for yourself: https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIScreen_Class/). You'd either have to find a private method, an external library that provides this functionality, or make it yourself. – Hamish Jan 17 '16 at 14:50
  • dear luk2302 , please look the image – user5465320 Jan 17 '16 at 14:50
  • originaluser2 , thanks . but believe me ! many iOS app have this function – user5465320 Jan 17 '16 at 14:57

1 Answers1

0

Have you tested [[UIScreen mainScreen] setBrightness:0.1]; for values from 0.0 to 1.0 over a noticeable time span? Does the brightness change? Do you get the UI?

GlennRay
  • 959
  • 9
  • 18