2010-02-02 161 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