IOS6 handheld Processing
Many features from iOS 5 application updates to iOS 6 cannot work normally. The main problem is that some APIs have been discarded in the new SDK. The hand-held direction is obviously
Problems
For example, if your application only has one screen and all other screens are portrait.
IOS 5 Solution
In the Info. plist file of the application, Supported interface orientations should only contain one project, Portrait.
Next, you need to rewrite the-(BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation method in the required direction lock as a horizontal view controller class, and return a Boolean value relative to YES or NO, check the interfaceOrientation parameter.
The following is what the function looks like.
-(BOOL) shouldAutorotateToInterfaceOrientation :( UIInterfaceOrientation) interfaceOrientation
{
Return (interfaceOrientation = UIInterfaceOrientationLandscapeLeft |
InterfaceOrientation = UIInterfaceOrientationLandscapeRight );
}
IOS 6 Solution
In iOS 6-(BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) The interfaceOrientation method is outdated and does not seem to have been called. Instead of a set of methods;-(BOOL) shouldAutorotate and-(NSUInteger) supportedInterfaceOrientations.
In UIViewController, if you want to be horizontal, You need to rewrite the-(BOOL) shouldAutorotate-(NSUInteger) supportedInterfaceOrientations at the same time:
// IOS6 is out of date, to be compatible with iOS5.
//---
-(BOOL) shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation) interfaceOrientation
{
Return (interfaceOrientation = UIInterfaceOrientationLandscapeLeft |
InterfaceOrientation = UIInterfaceOrientationLandscapeRight );
}
// IOS6 support
//---
-(BOOL) shouldAutorotate
{
Return NO;
}
-(NSUInteger) supportedInterfaceOrientations
{
Return UIInterfaceOrientationMaskLandscape;
}
//---