2010-02-02 166 views
0

我正在努力强制将视图变成横向模式,并且已经拿起各种酷炫的提示来实现此目的,但是我卡在留在屏幕上的一个项目上。iPhone旋转问题

我有我的XIB文件中的景观布局,并在我的代码创建一般视图控制器:

RedeemViewController *aViewController = [[RedeemViewController alloc] initWithNibName:@"RedeemViewController" bundle:nil]; 
    aViewController.hidesBottomBarWhenPushed = YES; 
    aViewController.wantsFullScreenLayout = YES; 
[[self navigationController] pushViewController:aViewController animated:YES]; 

内部控制器viewDidLoad中我完成以下步骤:

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight]; 
[[self navigationController] setNavigationBarHidden:YES animated:YES]; 


[UIView beginAnimations:@"View Flip" context:nil]; 
[UIView setAnimationDuration:.75]; 
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 

if (self.interfaceOrientation == UIInterfaceOrientationPortrait) {  
self.view.transform = CGAffineTransformIdentity; 
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(90)); 
self.view.bounds = CGRectMake(0.0, 0.0, 480, 320); 
} 
[UIView commitAnimations]; 

我最后是一个完美旋转的视图,在左侧有一个灰色的竖条(见图)。 alt text http://taxhelp.net/vert_bar.png

所以对于这个问题,我该如何摆脱酒吧?

编辑:我很确定这是没有被隐藏的导航栏。

回答

3

您的边界矩形是在原点(0,-20)处创建的。将其更改为(0,0),您应该消除偏移量并使视图填满屏幕。

+0

哦,我的坏,我调试了一下,看看我是否可以移动图像。我在0.0处得到相同的结果,并将其更改为-20.0将图像向下移动一点,但不会向左或向右移动。这是尝试在状态栏下移动视图,否则状态栏将覆盖视图的顶部。我已经取消了以上的-20。 – 2010-02-02 21:17:14