Return to Snippet

Revision: 41745
at February 23, 2011 02:33 by takezou621


Initial Code
// 近接センサーを使用する
[UIDevice currentDevice].proximityMonitoringEnabled = YES;

// 変更の通知を受け取るメソッドの登録
[[NSNotificationCenter defaultCenter]
 addObserver: self
 selector:@selector(proximityStateDidChange: )
 name:UIDeviceProximityStateDidChangeNotification
 object:nil];

// 近接センサーの状態変更時に呼び出されるメソッド
- (void) proximityStateDidChange:(NSNotification *)notification{
	NSLog(@"%s",__PRETTY_FUNCTION__);
	NSLog(@"state = %@",
		  [UIDevice currentDevice].proximityState ? @"YES":@"NO");
}

Initial URL

                                

Initial Description

                                

Initial Title
近接センサー

Initial Tags

                                

Initial Language
Objective C