iOS 屏幕亮度调节

  • 设置屏幕亮度:
    UIScreen.h
@property(nonatomic) CGFloat brightness NS_AVAILABLE_IOS(5_0) __TVOS_PROHIBITED; // 0 .. 1.0, where 1.0 is maximum brightness. Only supported by main screen.```

[[UIScreen mainScreen] setBrightness:0.5]; //屏幕半亮```

  • 设置屏幕长亮
    UIApplication.h
@property(nonatomic,getter=isIdleTimerDisabled)  BOOL idleTimerDisabled; // default is NO```

[[UIApplication sharedApplication] setIdleTimerDisabled:YES]; //保持屏幕长亮状态
[[UIApplication sharedApplication] setIdleTimerDisabled:NO]; //关闭屏幕长亮状态```

你可能感兴趣的:(iOS 屏幕亮度调节)