我的视图最初是横向模式。当一个按钮被点击时,一个视图以纵向模式打开,到目前为止一切都找到了。问题是当我从该视图返回到根视图时,视图将无法正确旋转。这是我用来将视图从纵向旋转到横向的代码,
-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
//rotate the page to lansscape
CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(-90*0.0174532925);
landscapeTransform = CGAffineTransformTranslate (landscapeTransform, 0.0, 0.0);
[self.navigationController.view setTransform:landscapeTransform];
self.navigationController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight;
self.navigationController.view.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, self.view.frame.size.height);
self.navigationController.view.center = CGPointMake (384.0, 544.0);
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeLeft;
}
这是从纵向页面返回后横向模式下的根页面的屏幕截图,
这就是它的样子