SoFunction
Updated on 2025-04-12

Force individual pages to screen horizontally and vertically on iOS

existAdd it inside@property(nonatomic,assign)NSInteger allowRotation;

Add in the file

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
 {
   if (_allowRotation == 1) {
     return UIInterfaceOrientationMaskLandscapeRight;
   }
   else
   {
     return (UIInterfaceOrientationMaskPortrait);
   }
 }

This defaults that the page is vertical screen, and the controller of the page that is to force horizontal screen to be controlledUIViewControllerInside, introduce#import “”
Then

(void)viewDidLoad 
{ 
[super viewDidLoad]; 
AppDelegate * appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; 
 = 1; 
}

You can make individual pages horizontally screened, and modify the status before jumping out of this horizontal screen page, as follows

AppDelegate *delegate = [[UIApplication sharedApplication]delegate];
   = 0;

This allows you to fully realize the horizontal screen of the page.

The above is the editor introduced to you that individual pages are forced to screen horizontally on other pages on iOS. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!