Uideviceorientation is the current direction of rotation of the machine hardware. You can only take a value and not set
Uiinterfaceorientation is the current rotation direction of your program interface this can be set
Determine the current direction of the device:- (BOOL) shouldautorotatetointerfaceorientation: (uiinterfaceorientation) interfaceorientation { uidevice *device = [UIDevice currentDevice] ; //obtained the direction of the former device, to Syria the sentence. (Device in the direction of integer) switch (device.orientation) { case UIDeviceOrientationFaceUp: nslog (@ "The screen faces up flat"); break; case uideviceorientationfacedown: nslog (@ "screen facing down"); break; //system can not judge the current device direction, there may be a bias case uideviceorientationunknown: nslog (@ "Unknown direction"); break; case UIDeviceOrientationLandscapeLeft: nslog (@ "screen left horizontal"); break; case uideviceorientationlandscaperight: nslog (@ "screen right horizontal"); break; case UIDeviceOrientationPortrait: nslog (@ "screen upright"); break; case uideviceorientationportraitupsidedown: nslog (@ "Vertical screen" , up and down Upside down "); break; default: nslog (@ "Unable to recognize"); break; } // Return YES for supported orientations return (interfaceorientation == Uiinterfaceorientationlandscapeleft); // only supports horizontal, yes to the left to support all directions }
Or-(BOOL) Shouldautorotatetointerfaceorientation: (uiinterfaceorientation) interfaceorientation {UIDeviceOrientati On deviceorientation = [Uidevice currentdevice].orientation; if (Uideviceorientationislandscape (deviceorientation)) NSLog (@ "Landscape"); Else