IOS横屏事件

来源:互联网 发布:网易蜂巢和阿里云 编辑:程序博客网 时间:2024/06/09 06:37

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
   [[NSNotificationCenter defaultCenter] addObserver:self
     
                                             selector:@selector(deviceOrientationDidChange:)
     
                                                 name:UIDeviceOrientationDidChangeNotification
     
                                               object:nil];


-(void)deviceOrientationDidChange:(NSObject*)sender{
    UIDevice* device = [sender valueForKey:@"object"];
    NSLog(@"%d",device.orientation);
    
}

0 0