IOS 6 handheld Processing

Source: Internet
Author: User

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;
}
//---

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.