iphone auto lock value?

2020-04-14 06:55发布

问题:

Isn't possible to retrieve auto lock value? Or anyone know how to modify the auto lock time like those existing alarm application?

Thanks.

回答1:

You can do it. you need to implement the following methods

- (void)applicationWillResignActive:(UIApplication *)application

This gets called when the phone is locked. In this method I would store the time and then impliment this method on the app delegate.

- (void)applicationDidBecomeActive:(UIApplication *)application

This function will be called when unlocking the phone. Use the time you stored when locking the time to determine how long it has been.

You can use this two methods for custom implementation of auto lock interval.



回答2:

Yes Jason is right. you can use [application setIdleTimerDisabled:YES]; to stop the autosleep. But there is no way to access the auto lock value.

Regards, Raxit