IOS 9 Force Horizontal screen

Source: Internet
Author: User

First supported the interface orientations option in the plist file leaves only one portrait

The screen forces a horizontal screen using the following code

Self.navigationController.view.transform = Cgaffinetransformmakerotation (M_PI/2);

Self.navigationController.view.frame = CGRectMake (0, 0, screen_width, screen_height);

[[UIApplication sharedapplication] setstatusbarhidden:yes];

Return to normal vertical display (added in viewwilldisappear)

Self.navigationController.view.transform = cgaffinetransformidentity;

Self.navigationController.view.frame = [UIScreen mainscreen].bounds;

[[UIApplication sharedapplication] setstatusbarhidden:no];

The Statusbarorientation property in UIApplication has not been used in iOS 9 to hide the status bar directly from pages that require a horizontal screen in the project.

Resources reprinted from: http://www.cnblogs.com/jiackyan/p/3382734.html

IOS 9 Force 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.