开发者

iPod goes to sleep when only accelerometer is used

开发者 https://www.devze.com 2023-02-27 06:32 出处:网络
I have a problem with my current game.In this game i have to move a pouch using accelerometer , but the problem is w开发者_如何转开发hen i use only accelerometer (without any touch in screen) iPod scr

I have a problem with my current game.In this game i have to move a pouch using accelerometer , but the problem is w开发者_如何转开发hen i use only accelerometer (without any touch in screen) iPod screen become dim and then goes to sleep.

So is there any parameter which i need to set to refrain iPod/iPhone from going to sleep.


To disable auto-sleep:

[UIApplication sharedApplication].idleTimerDisabled = YES;

To re-enable:

[UIApplication sharedApplication].idleTimerDisabled = NO;

Reference: http://developer.apple.com/library/ios/documentation/uikit/reference/UIApplication_Class/Reference/Reference.html#//apple_ref/occ/instp/UIApplication/idleTimerDisabled

0

精彩评论

暂无评论...
验证码 换一张
取 消