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

设计师给的需求设计上添加了一个页面要横屏显示

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

突然不想说了参考了

成都创新互联公司专业为企业提供哈密网站建设、哈密做网站、哈密网站设计、哈密网站制作等企业网站建设、网页设计与制作、哈密企业网站模板建站服务,十载哈密做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

iPhone开发之-横竖屏 切换push

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

赶时间了,不细细说了

解决方案是:

 

  1. // 
  2. //  MNViewController.m 
  3. //  LeeDemoProject 
  4. // 
  5. //  Created by mobilenow03 on 12-10-29. 
  6. //  Copyright (c) 2012年 mobilenow03. All rights reserved. 
  7. // 
  8.  
  9. #import "SecondVC.h" 
  10. #import  
  11. @interface SecondVC () 
  12.  
  13. @end 
  14.  
  15. @implementation SecondVC 
  16. @synthesize _imgVBackground,_vTransform; 
  17. - (void)dealloc { 
  18.     [_imgVBackground release]; 
  19.     [_vTransform release]; 
  20.     [super dealloc]; 
  21. - (void)viewDidLoad 
  22.     [super viewDidLoad]; 
  23.     // Do any additional setup after loading the view, typically from a nib. 
  24. //    [UIView beginAnimations:nil context:nil]; 
  25. //     
  26. //    [UIView setAnimationDuration:0.3]; 
  27.      
  28.     //设置导航栏旋转 
  29.      
  30.     self.navigationController.navigationBarHidden = YES; 
  31.      
  32.      
  33.      
  34. - (id)init 
  35.     self = [super init]; 
  36.     if (self) 
  37.     { 
  38.          
  39. //        [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 
  40. //        [[NSNotificationCenter defaultCenter] addObserver:self 
  41. //                                                 selector:@selector(orientationChanged:) 
  42. //                                                     name:UIDeviceOrientationDidChangeNotification 
  43. //                                                   object:nil]; 
  44.     } 
  45.     return self; 
  46.  
  47.  
  48. -(void)viewDidUnload 
  49.     [self set_vTransform:nil]; 
  50.     [super viewDidUnload]; 
  51.  
  52. -(void)viewWillAppear:(BOOL)animated 
  53.     [super viewWillAppear:animated]; 
  54.     self.view.bounds = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); 
  55.      
  56.     self.view.transform = CGAffineTransformMakeRotation( M_PI*1.5); 
  57. //    if ([[UIDevice currentDevice].systemVersion floatValue] >= 6.0) { 
  58. //        self.view.bounds = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); 
  59. //         
  60. //        self.view.transform = CGAffineTransformMakeRotation(-M_PI*1.5); 
  61. //    }else 
  62. //    { 
  63. //        [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated: YES]; 
  64. //        CGFloat duration = [UIApplication sharedApplication].statusBarOrientationAnimationDuration; 
  65. //        [UIView beginAnimations:nil context:nil]; 
  66. //        [UIView setAnimationDuration:duration]; 
  67. //        self.navigationController.view.transform = CGAffineTransformIdentity; 
  68. //        self.navigationController.view.transform = CGAffineTransformMakeRotation(M_PI*(90)/180.0); 
  69. //        self.navigationController.view.bounds = CGRectMake(0, 0, 480, 320); 
  70. //        [UIView commitAnimations];   
  71. //    } 
  72.      
  73. //    [[NSNotificationCenter defaultCenter] postNotificationName:@"OnlyLandscape" object:@"SecondVC"]; 
  74. //    CGFloat angle = 90; 
  75. //    self._vTransform.layer.transform = CATransform3DMakeRotation(angle*M_PI/180.0, 0, 0.0, 1.0); 
  76.     //设置旋转动画 
  77.      
  78.      
  79. //    self.navigationController.navigationBar.transform = CGAffineTransformMakeRotation(M_PI*1.5); 
  80. //     
  81. //    //设置视图旋转 
  82. //     
  83. //    self.view.bounds = CGRectMake(0, -54, self.view.frame.size.width, self.view.frame.size.height); 
  84. //     
  85. //    self.view.transform = CGAffineTransformMakeRotation(-M_PI*1.5); 
  86. //     
  87. //    [UIView commitAnimations]; 
  88.  
  89. - (void)didReceiveMemoryWarning 
  90.     [super didReceiveMemoryWarning]; 
  91.     // Dispose of any resources that can be recreated. 
  92.  
  93. // 大头贴的测试环境下 
  94. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation 
  95. //    if ((orientation == UIInterfaceOrientationPortrait) || 
  96. //        (orientation == UIInterfaceOrientationLandscapeLeft)) 
  97. //        return YES; 
  98. //    if ((orientation == UIInterfaceOrientationLandscapeRight) || 
  99. //        (orientation == UIInterfaceOrientationLandscapeLeft)) 
  100. //        return YES; 
  101. //    else 
  102.         return NO; 
  103.  
  104.  
  105.  
  106. //-(BOOL)shouldAutorotate 
  107. //{ 
  108. //    return YES; 
  109. //} 
  110. - (IBAction)backBtnClicked:(id)sender { 
  111. //    if ([[UIDevice currentDevice].systemVersion floatValue] >= 6.0) { 
  112. //    }else 
  113. //    { 
  114. //        [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated: YES]; 
  115. //        CGFloat duration = [UIApplication sharedApplication].statusBarOrientationAnimationDuration; 
  116. //        [UIView beginAnimations:nil context:nil]; 
  117. //        [UIView setAnimationDuration:duration]; 
  118. //        self.navigationController.view.transform = CGAffineTransformIdentity; 
  119. //        self.navigationController.view.transform = CGAffineTransformMakeRotation(M_PI*(0)/180.0); 
  120. //        self.navigationController.view.bounds = CGRectMake(0, 0, 320, 480); 
  121. //        [UIView commitAnimations]; 
  122. //    } 
  123.     [self.navigationController popToRootViewControllerAnimated:YES]; 
  124.  
  125. //-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 
  126. //{ 
  127. //    if (fromInterfaceOrientation == UIInterfaceOrientationMaskLandscape) { 
  128. //        NSLog(@"从横屏"); 
  129. //    }else if (fromInterfaceOrientation == UIInterfaceOrientationMaskPortrait) { 
  130. //        NSLog(@"从肃屏"); 
  131. //    } 
  132. //} 
  133.  
  134. //-(NSUInteger)supportedInterfaceOrientations 
  135. //{ 
  136. //    return UIInterfaceOrientationMaskLandscape; 
  137. //} 
  138.  
  139. //static bool is = NO; 
  140. //- (void)orientationChanged:(NSNotification *)notification 
  141. //{ 
  142. //    UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation; 
  143. //    switch (deviceOrientation) { 
  144. //        case UIDeviceOrientationPortrait: 
  145. //        { 
  146. //             
  147. //        } 
  148. //            break; 
  149. //        case UIDeviceOrientationLandscapeLeft: 
  150. //        { 
  151. //             
  152. //        } 
  153. //            break; 
  154. //        case UIDeviceOrientationPortraitUpsideDown: 
  155. //        { 
  156. //             
  157. //        } 
  158. //            break; 
  159. //        case UIDeviceOrientationLandscapeRight: 
  160. //        { 
  161. //            if (!is) { 
  162. //                //self._imgVBackground.frame = CGRectMake(0, 0, 480, 320); 
  163. ////                self.view.bounds = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); 
  164. //                 
  165. //                self.view.transform = CGAffineTransformMakeRotation(M_PI*0.5); 
  166. //                is = YES; 
  167. //            } 
  168. //             
  169. //        } 
  170. //            break; 
  171. //             
  172. //        default: 
  173. //            break; 
  174. //    } 
  175. //} 
  176.  
  177. //-(void) 
  178. @end 

 


文章名称:ios6.0和6.0以下横竖屏幕转换问题处理
当前链接:http://cdiso.cn/article/piejgd.html

其他资讯