2009-03-02 54 views
5

我正在开发一个游戏,其中我使用横向模式我总共有4个视图。 2个视图正在以风景模式进入。但在第三个视图中,我有UITable和导航栏。我可以在横向模式下旋转表格,但无法转换导航栏和导航控制器。导航栏和导航控制器也有它的按钮。它也没有得到改变。所以任何人都可以有这个解决方案。 :)如何在横向模式下转换导航栏和导航控制器

回答

2

通过旋转90度来转换混控控制器的导航栏。 此外,你可能需要设置导航栏中心和框架设置合适的宽度,以适应风景模式..它为我工作:) 希望它可以帮助你。

1

在UIViewController的文档的类别:

处理轮作

interfaceOrientation财产
- shouldAutorotateToInterfaceOrientation:
- rotatingFooterView
- rotatingHeaderView
- willRotateToInterfaceOrientation:时间:
- willAnimateFirstHalfOfRotationToInter faceOrientation:时间:
- willAnimateSecondHalfOfRotationFromInterfaceOrientation:时间:
- didRotateFromInterfaceOrientation:

希望这可以帮助你。

A.

+0

谢谢您的回答它的工作原理 – Jyotsna 2009-03-02 10:55:06

7
#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]; 
} 
+0

对于一些背景。真正的甜汁正在改变导航控制器的视野本身。 – avelis 2014-03-28 15:17:45

相关问题