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