Force horizontal screen on iOS 9 and force horizontal screen on ios 9

Source: Internet
Author: User

Force horizontal screen on iOS 9 and force horizontal screen on ios 9

First, only one portrait is left in the Supported interface orientations option in the plist file.

Use the following code to force a horizontal screen

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

Self. navigationController. view. frame = CGRectMake (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );

[[UIApplication sharedApplication] setStatusBarHidden: YES];

When a normal portrait screen is returned (add it to viewWillDisappear)

Self. navigationController. view. transform = CGAffineTransformIdentity;

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

[[UIApplication sharedApplication] setStatusBarHidden: NO];

 

In UIApplication, The statusBarOrientation attribute is no longer available in ios 9, and the page in the project that needs to be horizontally hidden directly hides the status bar.

 

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

Related Article

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.