iOS device rotation support horizontal screen

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.