温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ios6.0和6.0以下横竖屏幕转换问题处理

发布时间:2020-05-27 12:33:22 阅读:1495 作者:xinji0702 栏目:移动开发
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>
设计师给的需求设计上添加了一个页面要横屏显示

本以为解决起来不是问题,没想到ios5下,这个问题就已经是个问题,因为页面设计上新页面出现是push进来的。
而苹果会让push进来的页面显示为原来屏幕的旋转度,这样会让整个view变形(已经说不清楚,话说以后有问题还是
发个博客一步步来解决比较好,可以随时截屏
 
 
 

突然不想说了参考了

iPhone开发之-横竖屏 切换push

http://blog.sina.com.cn/s/blog_7cac8562010112ch.html

赶时间了,不细细说了

解决方案是:

// //  MNViewController.m //  LeeDemoProject // //  Created by mobilenow03 on 12-10-29. //  Copyright (c) 2012年 mobilenow03. All rights reserved. //  #import "SecondVC.h" #import <QuartzCore/QuartzCore.h> @interface SecondVC ()  @end  @implementation SecondVC @synthesize _imgVBackground,_vTransform; - (void)dealloc {     [_imgVBackground release];     [_vTransform release];     [super dealloc]; } - (void)viewDidLoad {     [super viewDidLoad];     // Do any additional setup after loading the view, typically from a nib. //    [UIView beginAnimations:nil context:nil]; //     //    [UIView setAnimationDuration:0.3];          //设置导航栏旋转          self.navigationController.navigationBarHidden = YES;                } - (id)init {     self = [super init];     if (self)     {          //        [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; //        [[NSNotificationCenter defaultCenter] addObserver:self //                                                 selector:@selector(orientationChanged:) //                                                     name:UIDeviceOrientationDidChangeNotification //                                                   object:nil];     }     return self; }   -(void)viewDidUnload {     [self set_vTransform:nil];     [super viewDidUnload]; }  -(void)viewWillAppear:(BOOL)animated {     [super viewWillAppear: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 ([[UIDevice currentDevice].systemVersion floatValue] >= 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 //    { //        [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated: YES]; //        CGFloat duration = [UIApplication sharedApplication].statusBarOrientationAnimationDuration; //        [UIView beginAnimations:nil context:nil]; //        [UIView setAnimationDuration:duration]; //        self.navigationController.view.transform = CGAffineTransformIdentity; //        self.navigationController.view.transform = CGAffineTransformMakeRotation(M_PI*(90)/180.0); //        self.navigationController.view.bounds = CGRectMake(00480320); //        [UIView commitAnimations];   //    }      //    [[NSNotificationCenter defaultCenter] postNotificationName:@"OnlyLandscape" object:@"SecondVC"]; //    CGFloat angle = 90; //    self._vTransform.layer.transform = CATransform3DMakeRotation(angle*M_PI/180.000.01.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); //     //    [UIView commitAnimations];  } - (void)didReceiveMemoryWarning {     [super didReceiveMemoryWarning];     // Dispose of any resources that can be recreated. }  // 大头贴的测试环境下 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { //    if ((orientation == UIInterfaceOrientationPortrait) || //        (orientation == UIInterfaceOrientationLandscapeLeft)) //        return YES; //    if ((orientation == UIInterfaceOrientationLandscapeRight) || //        (orientation == UIInterfaceOrientationLandscapeLeft)) //        return YES; //    else         return NO;  }   //-(BOOL)shouldAutorotate //{ //    return YES; //} - (IBAction)backBtnClicked:(id)sender { //    if ([[UIDevice currentDevice].systemVersion floatValue] >= 6.0) { //    }else //    { //        [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated: YES]; //        CGFloat duration = [UIApplication sharedApplication].statusBarOrientationAnimationDuration; //        [UIView beginAnimations:nil context:nil]; //        [UIView setAnimationDuration:duration]; //        self.navigationController.view.transform = CGAffineTransformIdentity; //        self.navigationController.view.transform = CGAffineTransformMakeRotation(M_PI*(0)/180.0); //        self.navigationController.view.bounds = CGRectMake(00320480); //        [UIView commitAnimations]; //    }     [self.navigationController popToRootViewControllerAnimated:YES]; }  //-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation //{ //    if (fromInterfaceOrientation == UIInterfaceOrientationMaskLandscape) { //        NSLog(@"从横屏"); //    }else if (fromInterfaceOrientation == UIInterfaceOrientationMaskPortrait) { //        NSLog(@"从肃屏"); //    } //}  //-(NSUInteger)supportedInterfaceOrientations //{ //    return UIInterfaceOrientationMaskLandscape; //}  //static bool is = NO; //- (void)orientationChanged:(NSNotification *)notification //{ //    UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation; //    switch (deviceOrientation) { //        case UIDeviceOrientationPortrait: //        { //             //        } //            break; //        case UIDeviceOrientationLandscapeLeft: //        { //             //        } //            break; //        case UIDeviceOrientationPortraitUpsideDown: //        { //             //        } //            break; //        case UIDeviceOrientationLandscapeRight: //        { //            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 

 

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×