我正在使用iPhone5和iOS7。我希望使用" UIScreenBrightnessDidChangeNotification"来跟踪设备的亮度。有时它被正确地射击,有时不被射击。这是我的设备或iOS7或我的方法的问题吗?
- (void)viewDidLoad
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(brightnessChanged) name:UIScreenBrightnessDidChangeNotification object:nil];
}
-(void)brightnessChanged
{
NSLog(@"brightness is %f",[[UIScreen mainScreen] brightness]);
}