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