Several questions about the rotation of the iOS screen 1. General Settings 2. Individual Pages Force fixed screen

Source: Internet
Author: User

1. General Settings screen rotation (Device Orientation | | info.plist-----The settings in these two places are synchronous )

1) targets->general->deployment Info->device Orientation directly tick the desired device to locate the global properties

2) Supporting files->info.plist->supported interface Orientations Delete attribute value

2. Individual Page Force screen

Create a new Navigationcontroller class

Implement the following three methods

-(BOOL) shouldautorotate

{//Whether automatic rotation is supported

return YES;

}

-(Nsuinteger) supportedinterfaceorientations

{//Supported rotation direction

return [Self.viewControllers.lastObject

Supportedinterfaceorientations];

}

-(Uiinterfaceorientation) preferredinterfaceorientationforpresentation

{//The default orientation after entering the interface

return [Self.viewControllers.lastObject

Preferredinterfaceorientationforpresentation];

}

If the push-out viewcontroller needs to change the screen orientation horizontal screen or vertical screen

Override these three methods in the current Viewcontroller, but if the Shouldautorotate method is implemented in Navigationcontroller, The overridden Shouldautorotate method is no longer performed in Viewcontroller.

-(BOOL) shouldautorotate

{//Whether automatic rotation is supported

return YES;

}

-(Nsuinteger) supportedinterfaceorientations

{//Supported rotation direction

Return (enumeration value);

}

-(Uiinterfaceorientation) preferredinterfaceorientationforpresentation

{//The default orientation after entering the interface

Return (enumeration value);

}

Several questions about the rotation of the iOS screen 1. General Settings 2. Individual Pages Force fixed screen

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.