我有一個基於標籤欄的應用程序。如何將視圖旋轉到標籤欄應用程序中的風景
我在Interface Builder中構建了2個視圖,一個是縱向模式,另一個是橫向模式。
現在,我想要的iPod應用程序。我想將橫向視圖設爲全屏,並隱藏狀態欄的標籤欄&。
我做工作的這個基本的:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration {
if (self.landscape) {
if (toInterfaceOrientation == UIInterfaceOrientationPortrait)
{
self.view = self.portrait;
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(360));
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft)
{
self.view = self.landscape;
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(-90));
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
self.view = self.landscape;
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(90));
}
else
{
self.view = self.portrait;
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(-180));
}
}
}
但是所有的工作混亂。橫向視圖不能正確填充區域,並且控件位於錯誤的位置,與首先設計的不同。
而且,我還沒有通過調用
setStatusBarHidden:(BOOL)
上的UIApplication參考
,像這樣找到了一種方法來隱藏一切......
謝謝! – mobius 2011-10-30 19:49:22