ios6.0和6.0以下横竖屏幕转换问题处理
本以为解决起来不是问题,没想到ios5下,这个问题就已经是个问题,因为页面设计上新页面出现是push进来的。
而苹果会让push进来的页面显示为原来屏幕的旋转度,这样会让整个view变形(已经说不清楚,话说以后有问题还是
发个博客一步步来解决比较好,可以随时截屏)
突然不想说了参考了
iPhone开发之-横竖屏切换pushhttp://blog.sina.com.cn/s/blog_7cac8562010112ch.html
赶时间了,不细细说了
解决方案是:
////MNViewController.m//LeeDemoProject////Createdbymobilenow03on12-10-29.//Copyright(c)2012年mobilenow03.Allrightsreserved.//#import"SecondVC.h"#import<QuartzCore/QuartzCore.h>@interfaceSecondVC()@end@implementationSecondVC@synthesize_imgVBackground,_vTransform;-(void)dealloc{[_imgVBackgroundrelease];[_vTransformrelease];[superdealloc];}-(void)viewDidLoad{[superviewDidLoad];//Doanyadditionalsetupafterloadingtheview,typicallyfromanib.//[UIViewbeginAnimations:nilcontext:nil];////[UIViewsetAnimationDuration:0.3];//设置导航栏旋转self.navigationController.navigationBarHidden=YES;}-(id)init{self=[superinit];if(self){//[[UIDevicecurrentDevice]beginGeneratingDeviceOrientationNotifications];//[[NSNotificationCenterdefaultCenter]addObserver:self//selector:@selector(orientationChanged:)//name:UIDeviceOrientationDidChangeNotification//object:nil];}returnself;}-(void)viewDidUnload{[selfset_vTransform:nil];[superviewDidUnload];}-(void)viewWillAppear:(BOOL)animated{[superviewWillAppear:animated];self.view.bounds=CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height);self.view.transform=CGAffineTransformMakeRotation(M_PI*1.5);//if([[UIDevicecurrentDevice].systemVersionfloatValue]>=6.0){//self.view.bounds=CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height);////self.view.transform=CGAffineTransformMakeRotation(-M_PI*1.5);//}else//{//[[UIApplicationsharedApplication]setStatusBarOrientation:UIInterfaceOrientationLandscapeRightanimated:YES];//CGFloatduration=[UIApplicationsharedApplication].statusBarOrientationAnimationDuration;//[UIViewbeginAnimations:nilcontext:nil];//[UIViewsetAnimationDuration:duration];//self.navigationController.view.transform=CGAffineTransformIdentity;//self.navigationController.view.transform=CGAffineTransformMakeRotation(M_PI*(90)/180.0);//self.navigationController.view.bounds=CGRectMake(0,0,480,320);//[UIViewcommitAnimations];//}//[[NSNotificationCenterdefaultCenter]postNotificationName:@"OnlyLandscape"object:@"SecondVC"];//CGFloatangle=90;//self._vTransform.layer.transform=CATransform3DMakeRotation(angle*M_PI/180.0,0,0.0,1.0);//设置旋转动画//self.navigationController.navigationBar.transform=CGAffineTransformMakeRotation(M_PI*1.5);//////设置视图旋转////self.view.bounds=CGRectMake(0,-54,self.view.frame.size.width,self.view.frame.size.height);////self.view.transform=CGAffineTransformMakeRotation(-M_PI*1.5);////[UIViewcommitAnimations];}-(void)didReceiveMemoryWarning{[superdidReceiveMemoryWarning];//Disposeofanyresourcesthatcanberecreated.}//大头贴的测试环境下-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation{//if((orientation==UIInterfaceOrientationPortrait)||//(orientation==UIInterfaceOrientationLandscapeLeft))//returnYES;//if((orientation==UIInterfaceOrientationLandscapeRight)||//(orientation==UIInterfaceOrientationLandscapeLeft))//returnYES;//elsereturnNO;}//-(BOOL)shouldAutorotate//{//returnYES;//}-(IBAction)backBtnClicked:(id)sender{//if([[UIDevicecurrentDevice].systemVersionfloatValue]>=6.0){//}else//{//[[UIApplicationsharedApplication]setStatusBarOrientation:UIInterfaceOrientationLandscapeRightanimated:YES];//CGFloatduration=[UIApplicationsharedApplication].statusBarOrientationAnimationDuration;//[UIViewbeginAnimations:nilcontext:nil];//[UIViewsetAnimationDuration:duration];//self.navigationController.view.transform=CGAffineTransformIdentity;//self.navigationController.view.transform=CGAffineTransformMakeRotation(M_PI*(0)/180.0);//self.navigationController.view.bounds=CGRectMake(0,0,320,480);//[UIViewcommitAnimations];//}[self.navigationControllerpopToRootViewControllerAnimated:YES];}//-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation//{//if(fromInterfaceOrientation==UIInterfaceOrientationMaskLandscape){//NSLog(@"从横屏");//}elseif(fromInterfaceOrientation==UIInterfaceOrientationMaskPortrait){//NSLog(@"从肃屏");//}//}//-(NSUInteger)supportedInterfaceOrientations//{//returnUIInterfaceOrientationMaskLandscape;//}//staticboolis=NO;//-(void)orientationChanged:(NSNotification*)notification//{//UIDeviceOrientationdeviceOrientation=[UIDevicecurrentDevice].orientation;//switch(deviceOrientation){//caseUIDeviceOrientationPortrait://{////}//break;//caseUIDeviceOrientationLandscapeLeft://{////}//break;//caseUIDeviceOrientationPortraitUpsideDown://{////}//break;//caseUIDeviceOrientationLandscapeRight://{//if(!is){////self._imgVBackground.frame=CGRectMake(0,0,480,320);////self.view.bounds=CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height);////self.view.transform=CGAffineTransformMakeRotation(M_PI*0.5);//is=YES;//}////}//break;////default://break;//}//}//-(void)@end
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。