IOS6.0 xcode4.5 set landscape Screen

Source: Internet
Author: User

After upgrading xcode4.5 iOS 6.0, the previous horizontal screen project changed to a vertical screen. The following are the solutions:

Initialization Method in AppDelegate

-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) in launchOptions

Set

[Window addSubview: viewController. view];

Replace it with the following code:

If ([[UIDevice currentDevice]. systemVersion floatValue] <6.0)

{// Warning: addSubView doesn't work on iOS6

[Window addSubview: viewController. view];

}

Else

{// Use this mehod on ios6

[Window setRootViewController: viewController];

}

Add the following two methods to RootViewController:

-(NSUInteger) supportedInterfaceOrientations {

Return UIInterfaceOrientationMaskLandscape;

}

-(BOOL) shouldAutorotate {

Return YES;

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.