Recently in the company to do the ipad development, unlike most iphone applications, the ipad program requires support for the screen, but sometimes some pages do not need screen rotation, Internet search a lot of data found are not available or meet the requirements. First, the following methods are rewritten directly in the Uiviewcontroller, and the discovery is not performed.
- (BOOL) shouldautorotate; - (Nsuinteger) supportedinterfaceorientations; -(uiinterfaceorientation) preferredinterfaceorientationforpresentation;
Best, find the solution, first create a new category of Uinavigatetion, and then rewrite the method inside
-(BOOL) shouldautorotate {// support auto-rotation return [[Self.viewcontrollers Lastobject] Shouldautorotate];} -(Nsuinteger) supportedinterfaceorientations {// device Support direction return [[ Self.viewcontrollers Lastobject] supportedinterfaceorientations];} -(Uiinterfaceorientation) preferredinterfaceorientationforpresentation {// Direction identification return [[Self.viewcontrollers Lastobject] preferredinterfaceorientationforpresentation];}
Then, in your uiviewcontroller to implement the above several methods, you can control the direction of the screen with your heart.
iOS manual control on, disable screen rotation