开发者

disable automatic locking on iphone with iOS 4.3.3

I want to disable the auto lock on my iOS4.3.3 program. I found on the web the开发者_如何学Go same answer several times for this and working for xcode3 but I cant find it to work with mine.. help pls? thks


This should work on iOS 4.3.3. If not then you're doing something wrong:

[[UIApplication sharedApplication] setIdleTimerDisabled:YES];


I did it in a ViewController like this.

-(void) viewDidAppear:(BOOL)animated
{
    [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
}

-(void) viewDidDisappear:(BOOL)animated
{
    [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜