突然不想说了参考了
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(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
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。