我有一个奇怪的,我希望有人可以帮忙。 我有一个应用程序,当我旋转为横向,我隐藏导航栏...在iPhone上隐藏/显示NavigationBar旋转导致迷失方向NavigationBar
-(void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if(toInterfaceOrientation == UIInterfaceOrientationPortrait)
{
self.view = portraitView;
}
else if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft)
{
self.view = landscapeRightView;
[self.navigationController setNavigationBarHidden:YES animated:NO];
}
该工程确定和的NavBar消失。问题是,当我旋转回肖像时,我的NavBar重新出现,但在视图中间是垂直的,而不是在屏幕顶部水平!无论我在哪里放置NavBar(旋转后,上半场后),在回到纵向视图时总是出现错误的方向和位置。
这是我对轮换代码回纵向:
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
if(self.view == portraitView)
{
[self.navigationController setNavigationBarHidden:NO animated:NO];
}
}
任何人都可以提供想法?这真让我抓狂!
你是否解决了这个问题? – lomec 2013-03-07 09:59:13