//获得设备方向
UIInterfaceOrientation orientation = [[UIApplicationsharedApplication]statusBarOrientation];
//程序启动时获取当前驱动的方向的方法
[[UIDevicecurrentDevice]beginGeneratingDeviceOrientationNotifications];
UIDeviceOrientation currentOrientation = [ [UIDevicecurrentDevice]orientation];
[[UIDevicecurrentDevice]endGeneratingDeviceOrientationNotifications];