怎么来设置[UIApplication sharedApplication] idleTimerDisabled 属性来控制自动锁屏的效果
// 把设置
idleTimerDisabled
的代码放到applicationDidEnterBackground
里还原系统设置
- (void)applicationDidEnterBackground:(UIApplication *)application {
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
}
// 把设置idleTimerDisabled
的代码放到
applicationDidBecomeActive
里取消自动锁屏效果
- (void)applicationDidBecomeActive:(UIApplication *)application { [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; }
时间: 2024-10-18 18:56:16