默认情况下所有iOS设备,在过了设定的休眠时间后都会自动锁屏。
如果你的应用不希望iOS设备自动锁屏,可以使用以下方式来保持屏幕一直开着。
@property(nonatomic, getter=isIdleTimerDisabled) BOOL idleTimerDisabled
Description A Boolean value that controls whether the idle timer is disabled for the app.(一个控制APP的休闲时钟的状态的布尔值)
Availability iOS (2.0 and later)
Declared In UIApplication.h
Reference UIApplication Class Reference
禁用休闲时钟(返回的BOOL值)
[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
或者
[UIApplication sharedApplication].idleTimerDisabled = YES;
[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
或者
[UIApplication sharedApplication].idleTimerDisabled = YES;
网友评论