4

我已经看到这个问题被问了几次,但没有人回答 - 事实上这可能是不可能的,但我想知道当 iPhone 上的proximityState 发生变化时,是否有办法防止屏幕变黑?

我已经实现了一种方法来在接近状态发生变化时做某事,但是屏幕会闪烁到黑色,我想避免这种情况。这是我的代码:

[nc addObserver:self selector:@selector(proximityChanged:) name:UIDeviceProximityStateDidChangeNotification 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

    }

}
4

1 回答 1

2

遗憾的是,当前的公共 API 不允许您这样做。您可能想通过 Apple Bug Reporter 提交增强请求:http: //developer.apple.com/bugreporter/

于 2011-08-13T17:04:01.970 回答