1. 程式人生 > >ios程式 設定不黑屏 禁止黑屏

ios程式 設定不黑屏 禁止黑屏

Objective-C:

[[UIApplication sharedApplication] setIdleTimerDisabled: YES];

Swift:

UIApplication.sharedApplication().idleTimerDisabled =true

Swift 3:

UIApplication.shared.isIdleTimerDisabled =true