我有一个基于标签栏的应用程序。如何将视图旋转到标签栏应用程序中的风景
我在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