iOS伪亮度调节/控制
iOS并没有开放控制系统亮度的接口,所以app能做到的只是比系统设置的亮度更暗,具体做法就是在整个app的keywindow之上再放一个window,设置黑色背景,通过控制alpha值来达到明暗变化。
[cpp]
- (void)installBrightnessWindow
{
m_brightnessWindow = [[UIWindow alloc] initWithFrame:self.view.window.frame];
m_brightnessWindow.windowLevel = UIWindowLevelStatusBar + 1;
m_brightnessWindow.userInteractionEnabled = NO;
m_brightnessWindow.backgroundColor = [UIColor blackColor];
m_brightnessWindow.alpha = 0;
m_brightnessWindow.hidden = NO;
}
- (void)installBrightnessWindow
{
m_brightnessWindow = [[UIWindow alloc] initWithFrame:self.view.window.frame];
m_brightnessWindow.windowLevel = UIWindowLevelStatusBar + 1;
m_brightnessWindow.userInteractionEnabled = NO;
m_brightnessWindow.backgroundColor = [UIColor blackColor];
m_brightnessWindow.alpha = 0;
m_brightnessWindow.hidden = NO;
}
补充:移动开发 , IOS ,