Wednesday, May 22, 2013

UIApplication idleTimerDisabled example ios


[UIApplication idleTimerDisabled]

A Boolean value that controls whether the idle timer is disabled for the application.
@property(nonatomic, getter=isIdleTimerDisabled) BOOL idleTimerDisabled
Discussion of [UIApplication idleTimerDisabled]
The default value of this property is NO. When most applications have no touches as user input for a short period, the system puts the device into a "sleep” state where the screen dims. This is done for the purposes of conserving power. However, applications that don't have user input except for the accelerometer—games, for instance—can, by setting this property to YES, disable the “idle timer” to avert system sleep. [UIApplication idleTimerDisabled]



Example of [UIApplication idleTimerDisabled]
try to use
[UIApplication sharedApplication].idleTimerDisabled = NO;
[UIApplication sharedApplication].idleTimerDisabled = YES;
instead of
[UIApplication sharedApplication].idleTimerDisabled = YES;

/* Block idleTimer */
application.idleTimerDisabled = YES;

/* DO ALL YOUR STUFF */
/* AND IF SOMETHING APPEN */

/* Restore idleTimer */
application.idleTimerDisabled = NO;