清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
1、 开发的时候已竖屏的尺寸开发
self.view.frame = CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.height, [[UIScreen mainScreen] bounds].size.width);
2、 旋转视图
//设置状态栏
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:NO];
CGFloat duration = [UIApplication sharedApplication].statusBarOrientationAnimationDuration;
//设置旋转动画
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:duration];
//设置导航栏旋转
self.navigationController.navigationBar.frame = CGRectMake(-204,224, [[UIScreen mainScreen] bounds].size.height, 32);
self.navigationController.navigationBar.transform = CGAffineTransformMakeRotation(M_PI*1.5);
//设置视图旋转
self.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
self.view.transform = CGAffineTransformMakeRotation(M_PI*1.5);
[UIView commitAnimations];
self.view.bounds = CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.height, [[UIScreen mainScreen] bounds].size.width);
说明:1)这里要注意状态栏的方向和试图旋转方向保持一致性
2)必须自己设置类自身的bounds
3)状态栏旋转必须重写方法shouldAutorote方法
-(BOOL)shouldAutorotate
{
return NO;
}