//UIViewController的方法
//设置能否旋转
-(BOOL)shouldAutorotate
{
return YES;
}
//设置支持的方向
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
//控制能否旋转到某个方向
// 参数是将要旋转到的方向, 返回是否能旋转到这个方向
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return toInterfaceOrientation == UIInterfaceOrientationPortrait;
}
//处理旋转
//即将旋转
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
NSLog(@”即将旋转”);
}
//即将结束旋转
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
NSLog(@”旋转结束”);
}