在iPhone上屏幕旋转所用的方法在M文件中实现如下方法
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation{
return 旋转的参数(有四个)
}
如下:
垂直向上:UIInterfaceOrientationPortrait
垂直倒放:UIInterfaceOrientationPortraitDown
水平向左:UIInterfaceOrientationLandscapeLeft
水平向右:UIInterfaceOrientationLandscapeRigth
旋转要触发的事件
同时旋转还可以在程序配置文件当中配置
如何添加一个新的View视图
如何控制界面的旋转
代码如下
注意#define degressToTadians(x) (M_PI * (x) /180.0)是进行角度跟弧度的转换
self.view.transform = CGAffineTransformIdentty; //这句代码是给这个动画一个初始化的值,由如给变量int 赋值一个0一样
self.view.transform = CGAffineTransformMakeRotation(角度转换为弧度) //给动画一个弧度的值
self.view.bounds = CGRectMake(0.0,0.0,320.0,460.0) //是给本次旋转,也就是本次变化一个变化的背景,一个变化的范围