How the iOS device supports rotation:
1, modify the project Info.plist "supported interface Orientations" value (generally in the project Taget-> General, Deployment Info, Device Orientation to select Device support).
2. Implement the (Application:supportedinterfaceorientationsforwindow:) method in the Appdelegate file of the project, which returns the direction enumeration supported by the program in this method.
3, the implementation of a Viewcontroller support rotation after iOS6.0 can be through the following 2 methods:
-(BOOL) shouldautorotate{//whether rotation is supported
return YES;
}
-(nsuinteger) supportedinterfaceorientations{//Support rotation direction
returnuiinterfaceorientationmaskportrait;
}
Extended:
If the program interface requires only support vertical screen, but the project WebView pop-up video requirements to support horizontal screen playback, can be combined with the above mentioned in the 1th, 2 in the way to solve.
Workaround: Modify the engineering Info.plist value so that it supports only the portrait direction; then implement the Application:supportedinterfaceorientationsforwindow: method, Returns the Uiinterfaceorientationmaskallbutupsidedown value in this method. This way, even on the iphone6p or ipad screen launcher, the interface will not appear sideways, and on the iphone device video playback still support horizontal screen.
To solve the above problems caused by speculation:
By modifying the Info.plist to enable the device to support all directions, the width and height of the screen obtained by the [UIScreen mainscreen].bounds is changed accordingly.
Implement Application:supportedinterfaceorientationsforwindow: method to support each direction, and will not change [UIScreen mainscreen].bounds corresponding to the width of the high value.
The above question raises the conjecture that does not verify, if has the wrong place to welcome the correction ....
iOS device rotation support horizontal screen