开发者

disable automatic locking on iphone with iOS 4.3.3

开发者 https://www.devze.com 2023-04-08 08:31 出处:网络
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?

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

精彩评论

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

关注公众号