iOS 关于自动锁屏

2019-10-15  本文已影响0人  微笑城ios

关于iOS 开发关闭自动锁屏

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
// 关闭自动锁屏
    [UIApplication sharedApplication].idleTimerDisabled=YES;
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
// 开启自动锁屏
    [UIApplication sharedApplication].idleTimerDisabled=false;
}
上一篇 下一篇

猜你喜欢

热点阅读