Reputation: 23
On iPad iOS 6.0, how can you make it so that the screen does go to sleep, or somehow disables the graphics to preserve screen life, but the iPad does not lock, and it's not necessary to press the button. Instead, when the screen is touched, the iPad wakes up completely and the program is restored and continues running on the screen.
I understand that the touch capability is not functioning when the iPad has truly gone to sleep, so is there an intermediary sleep mode where the screen shuts down all pixel brightnesses, but remains alert for any touch notifications?
Upvotes: 2
Views: 5310
Reputation: 27597
You will need to prevent the "real" locking mechanism which can be done using the setIdleTimerDisabled:
method of your UIApplication
instance.
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
Then you may reduce the screen brightness using the setBrightness:
method of the shared UIScreen
instance.
[[UIScreen mainScreen] setBrightness:0.0f];
For "unlocking" the screen, do the reverse:
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
[[UIScreen mainScreen] setBrightness:1.0f];
Upvotes: 2
Reputation: 2203
Put a black uiview over everything, use
[[UIScreen mainScreen] setBrightness:0.0];
to adjust the brightness as low as you can, and then reverse these steps on touch.
that is about the only way I can think of to emulate the functionality you need without using some private api.
EDIT: setBrightness will only work on ios 5.0 and greater
Upvotes: 1