Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 使用UINavigationControoler/Navigation应用程序时出现UI方向问题_Iphone_Cocos2d Iphone - Fatal编程技术网

Iphone 使用UINavigationControoler/Navigation应用程序时出现UI方向问题

Iphone 使用UINavigationControoler/Navigation应用程序时出现UI方向问题,iphone,cocos2d-iphone,Iphone,Cocos2d Iphone,我创建了一个简单的导航应用程序。我允许应用程序的所有方向。 问题如下 我在景观方向。然后我从RootViewController导航到UIViewController以显示PDF。当我在UiviewControoler中时,我将方向更改为纵向。然后返回RootViewController。此时,RootViewController本身处于横向模式,它无法很好地显示整个UI 我真的不知道在网上搜索什么。我仍然试图搜索,但无法得到答案。有人能告诉我如何解决此问题吗?首先在应用程序委托文件中声明布尔类

我创建了一个简单的导航应用程序。我允许应用程序的所有方向。 问题如下 我在景观方向。然后我从RootViewController导航到UIViewController以显示PDF。当我在UiviewControoler中时,我将方向更改为纵向。然后返回RootViewController。此时,RootViewController本身处于横向模式,它无法很好地显示整个UI


我真的不知道在网上搜索什么。我仍然试图搜索,但无法得到答案。有人能告诉我如何解决此问题吗?

首先在应用程序委托文件中声明布尔类型变量,然后在.m文件中设置属性和合成。应用程序内delegate.m文件u

 - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
    toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
    MidwestTestAppDelegate *appDelegate = (MidwestTestAppDelegate *)[[UIApplication sharedApplication] delegate];
    appDelegate.isLandscapeLeft = TRUE;

}
else
{
    MidwestTestAppDelegate *appDelegate = (MidwestTestAppDelegate *)[[UIApplication sharedApplication] delegate];
    appDelegate.isLandscapeLeft = FALSE;


}
}
在.m文件中,u使用此函数,该函数为u指定方向是否启用。视图控制器也是如此。

在有方向更改的google serach导航控制器上,您应该查看presentModalViewController而不是pushViewController,因为push采用相同的方向,而present没有。如果您没有得到任何信息,则tellI没有得到一件事变量appDelegate。你能给我澄清一下吗?嘿,明白了。谢谢催眠appDelegate*appDelegate=催眠appDelegate*[[UIApplication sharedApplication]委托];在appdelegate.h文件中,您必须声明布尔类型变量。例如Bool IsLandscapeMode;和属性布尔IsLandscapeMode;在appdelegate.m文件synthsizeislandscapemode中;