ios6.0和6.0以下横竖屏幕转换问题处理
设计师给的需求设计上添加了一个页面要横屏显示
本以为解决起来不是问题,没想到ios5下,这个问题就已经是个问题,因为页面设计上新页面出现是push进来的。
而苹果会让push进来的页面显示为原来屏幕的旋转度,这样会让整个view变形(已经说不清楚,话说以后有问题还是
发个博客一步步来解决比较好,可以随时截屏
本以为解决起来不是问题,没想到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
- @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(0, 0, 480, 320);
- // [UIView commitAnimations];
- // }
- // [[NSNotificationCenter defaultCenter] postNotificationName:@"OnlyLandscape" object:@"SecondVC"];
- // CGFloat angle = 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);
- //
- // [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(0, 0, 320, 480);
- // [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
文章名称:ios6.0和6.0以下横竖屏幕转换问题处理
当前链接:http://cdiso.cn/article/piejgd.html