我正在开发一个游戏,其中我使用的是景观模式,我有总共4个视图。2个视图在横向模式中正常出现。但在第三个视图中,我有UITable和导航栏。我可以在横向模式下旋转桌子,但不能转换导航栏和导航控制器。导航栏和导航控制器上也有按钮。它也不会被转换。因此,任何人都可以对此有解决方案。:)
发布于 2009-03-02 07:28:29
将导航控制器的导航栏旋转90度来改变它。此外,您可能需要设置导航栏的中心和框架,以设置适当的宽度,以适应风景mode..it工作为我:)希望它也能帮助你。
发布于 2011-12-01 01:53:53
#define degreesToRadians(x) (M_PI * x / 180.0)
- (void)viewWillAppear:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
CGRect newBounds = CGRectMake(0, 0, 480, 320);
self.navigationController.view.bounds = newBounds;
self.navigationController.view.center = CGPointMake(newBounds.size.height / 2.0, newBounds.size.width / 2.0);
self.navigationController.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
self.navigationController.view.transform = CGAffineTransformIdentity;
self.navigationController.view.transform = CGAffineTransformMakeRotation(degreesToRadians(0));
self.navigationController.view.bounds = CGRectMake(0.0, 0.0, 320.0, 480.0);
[super viewWillDisappear:animated];
}发布于 2009-03-02 09:53:49
在UIViewController文档的类中:
处理旋转
interfaceOrientation属性
- shouldAutorotateToInterfaceOrientation:
- rotatingFooterView
- rotatingHeaderView
-willRotateToInterfaceOrientation:持续时间:
- willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:
- willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:
- didRotateFromInterfaceOrientation:
希望这对你也有帮助。
一个。
https://stackoverflow.com/questions/601397
复制相似问题