iPad从纵向转为横向
问题描述:
我的视图最初处于横向模式。当一个按钮被录音时,一个视图将以纵向模式打开,并且所有内容都可以在这一点上找到。问题是当我从该视图返回到根视图时视图将无法正确旋转。这里是我使用的旋转从纵向到横向视图中的代码,iPad从纵向转为横向
-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
//rotate the page to lan*e
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;
}
这里是风景模式根页面的屏幕截图从纵向页面返回后,
这是应该什么样子
答
-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
//rotate the page to lan*e
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+64);
self.navigationController.view.center = CGPointMake (384.0, 512.0);
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeLeft;
}
,我不得不打转转之后这一观点是在肖像模式下消失是这样的调整这是出现的景观视野的东西,
self.navigationController.view.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, self.view.frame.size.height+64);
self.navigationController.view.center = CGPointMake (384.0, 512.0);
我与中心点和框架高度调整发挥各地它。
检查您的xib方向视图。 – Santhosh
当然是风景! – Mona