Yesterday, my friend asked me how to achieve in the vertical screen application, display a horizontal screen of the application, because has not done
I don't know, but I think there will be such an API, because I have this type of software installed on my phone
When I woke up this morning, I wanted to make a dome out, and it was customary to find the data and test whether it was available, but
Find all write not very clear, it is easy to achieve the desired effect, so want to re-write a
Hope to help the people who have this need. (This is no experience, it is to put together the information on the Internet,
If there is an error, please forgive me, there is a better way to tell me.
The effect of the implementation:
Most of the page is vertical screen, individual pages can be rotated mobile phone when the page changed to horizontal screen (in fact, the needs of friends is to enter
This page is a horizontal screen, do not know how to do it.
Implementation steps:
1. Enable the app to traverse the screen, the newly created default will be
2. Implement the following methods in the view (the navigation controller and the Tabbar controller can)
-(BOOL) shouldautorotate{ return YES; -(Nsuinteger) supportedinterfaceorientations{ return [self.viewControllers.lastObject Supportedinterfaceorientations];} -(uiinterfaceorientation) preferredinterfaceorientationforpresentation{ return [ Self.viewControllers.lastObject preferredinterfaceorientationforpresentation];}
3. In a view controller that does not require a horizontal screen, implement the following methods
-(Nsuinteger) supportedinterfaceorientations{ return uiinterfaceorientationmaskportrait;} -(BOOL) shouldautorotate{ return NO; -(uiinterfaceorientation) preferredinterfaceorientationforpresentation{ return uiinterfaceorientationportrait;}
4, the need for a horizontal screen of the page does not require other processing on it.
Solution for single page horizontal screen in iOS vertical screen application