3

I have an App that is all day working in the same place and need a way to simulate a sleep mode as best as possible during a range of time.

I thought a simple solution, adding a black view... but sure there are better options. Can I control the brightness of the screen of the device? Any suggestions?

Thanks!

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
Fran Fox
  • 501
  • 5
  • 15
  • 2
    you can control the brightness: [UIScreen mainScreen].brightness = 0.5; – TonyMkenu Dec 06 '13 at 07:59
  • thanks Tony, its any way to make sure that the iPad not enter in sleep mode? – Fran Fox Dec 06 '13 at 09:48
  • 1
    to disable sleep mode use this: http://stackoverflow.com/a/5236619/1702413 you can read about that also here (Turning Off Screen Locking) https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/AdvancedAppTricks/AdvancedAppTricks.html#//apple_ref/doc/uid/TP40007072-CH7-SW63 – TonyMkenu Dec 06 '13 at 09:53
  • 1
    Welcome, Pay it forward! :) – TonyMkenu Dec 06 '13 at 10:35

1 Answers1

1

Normally an app that's running but has no user interaction for some period of time causes iOS to go into its own sleep mode. So your app sets that condition to keep the UI active all the time?

If so, sure, add a view to the window and animate it from transparent to full black. Put a gesture recognizer on it so if the user taps it, you animate back into translucent mode, then remove the view.

David H
  • 40,852
  • 12
  • 92
  • 138