2012/3/20

orientation 水平偵測

參考code如下
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter addObserver:self selector:@selector(deviceOrientationDidChange) name:UIDeviceOrientationDidChangeNotification object:nil]; - (void)deviceOrientationDidChange { NSLog(@"deviceOrientationDidChange"); NSLog(@"orientation:%i",[UIDevice currentDevice].orientation); }

沒有留言: