2011-08-13 42 views
4

我见过这个问题问了几次,但没有人回答 - 实际上这可能是不可能的,但我想知道是否有办法阻止屏幕在iPhone上的proximityState发生变化时变黑?防止iOS接近传感器将屏幕变成黑色

我已经实现了一种方法来做一些事情,当接近状态改变,但屏幕闪烁黑色,我想避免这种情况。这里是我的代码:

[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 

    } 

} 

回答