IOS Force Horizontal Screen

Source: Internet
Author: User

////AAAAVIEWCONTROLLER.M//HENGP////Created by Zhu Xinlei on 15/2/13.//Copyright (c) 2015 NIIT. All rights reserved.//#import "AAAAViewController.h"#import "AppDelegate.h"@interfaceAaaaviewcontroller ()@end@implementationAaaaviewcontroller- (ID) Initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) nibbundleornil{ Self=[Super Initwithnibname:nibnameornil Bundle:nibbundleornil]; if(self) {[self initview]; }    returnSelf ;}-(void) initview{UIButton*bt=[[uibutton Alloc]initwithframe:cgrectmake ( -, -, -, the)]; [BT Settitle:@"return"Forstate:uicontrolstatenormal];    [BT Setbackgroundcolor:[uicolor Bluecolor];    [BT addtarget:self Action: @selector (back) forcontrolevents:uicontroleventtouchupinside];                [Self.view ADDSUBVIEW:BT]; Appdelegate*appdelegate=[[uiapplication Sharedapplication]Delegate];    [[UIApplication sharedapplication] Setstatusbarorientation:uideviceorientationlandscaperight Animated:YES]; CGFloat Duration=[UIApplication sharedapplication].statusbarorientationanimationduration; //Set rotation animation[UIView Beginanimations:nil Context:nil];    [UIView setanimationduration:duration]; //set the navigation bar rotationAppdelegate.nav.navigationBar.frame = CGRectMake (-204,224,480, +); Appdelegate.nav.navigationBar.transform= Cgaffinetransformmakerotation (m_pi*1.5); //set the view rotationSelf.view.bounds = CGRectMake (0, - Wu, Self.view.frame.size.width, self.view.frame.size.height); Self.view.transform= Cgaffinetransformmakerotation (m_pi*1.5);    [Self setneedsstatusbarappearanceupdate];        [UIView commitanimations]; }-(uistatusbarstyle) preferredstatusbarstyle{returnuistatusbarstylelightcontent;}//-(BOOL) Prefersstatusbarhidden//For iOS7.0{    returnYES;}- (void) viewdidload {[Super viewdidload];    [Self.view Setbackgroundcolor:[uicolor Whitecolor]; }- (void) didreceivememorywarning {[Super didreceivememorywarning]; //Dispose of any resources the can be recreated.}-(void) back{appdelegate*appdelegate=[[uiapplication Sharedapplication]Delegate]; [Appdelegate.nav Popviewcontrolleranimated:yes];}/*#pragma mark-navigation//in a storyboard-based application, you'll often want to do a little preparation before n avigation-(void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: (ID) Sender {//Get the new view controller using [s]    Egue Destinationviewcontroller]. Pass the selected object to the new view controller.}*/@end

IOS Force Horizontal Screen

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.