开发者

Prevent the iOS proximity sensor from turning the screen black

开发者 https://www.devze.com 2023-03-28 02:39 出处:网络
I\'ve seen this question asked a couple of times but nobody has answered it - in fact it might be impossible, but I was wondering if there was a way to prevent the screen from going black when the pro

I've seen this question asked a couple of times but nobody has answered it - in fact it might be impossible, but I was wondering if there was a way to prevent the screen from going black when the proximityState changes on the iPhone?

I have implemented a method to do something when the proximity state changes, but the screen flickers to black and I want to avoid that. Here is my code:

[nc addObserver:self selector:@selector(proximityChanged:) name:UIDevicePr开发者_如何转开发oximityStateDidChangeNotification object:d];

- (void)proximityChanged:(NSNotification *)note {

    if ([[note object] proximityState] == 1) {

        // Do something once the face is close
        // This is where it goes to black


    } else {

        // Do something once the face pulls away

    }

}


Sadly, the current public APIs do not allow you to do this. You might want to file an enhancement request via the Apple Bug Reporter: http://developer.apple.com/bugreporter/

0

精彩评论

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