2010-01-28 40 views
0

難住這個。我正在使用這裏發佈的一段代碼將視圖旋轉到橫向。旋轉,尺寸調整和動畫效果很好,但當視圖旋轉時,狀態欄將作爲一個細小的灰色條帶掛起,這與隱藏狀態欄的大小相同。StatusBarHidden不能正常工作

下面是代碼:

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

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];   
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]; 

提前感謝!

+0

這有什麼更新?看起來像iOS 7有不同的方法:http://stackoverflow.com/a/18957926/1049134 – Rivera 2014-02-26 08:57:18

回答

1

您在視圖控制器上設置了wantsFullScreenLayout = YES嗎?

+0

給它一個鏡頭,沒有影響。在我分配了控制器並加載並顯示後試過了。 – 2010-01-28 02:36:43

0

iOS7:我將以下代碼添加到Info.plist以擺脫狀態欄永久。在另一個堆棧交換問題中找到它。

<key>UIStatusBarHidden</key> 
<true/> 
<key>UIViewControllerBasedStatusBarAppearance</key> 
<false/>