Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.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
Objective c iPad应用程序始终以纵向模式启动_Objective C_Orientation_Startup - Fatal编程技术网

Objective c iPad应用程序始终以纵向模式启动

Objective c iPad应用程序始终以纵向模式启动,objective-c,orientation,startup,Objective C,Orientation,Startup,这可能是几个线程的重复,但我找到的解决此问题的解决方案对我不起作用。我的应用程序总是以纵向模式启动,即使我的APP-Info.PList中有以下几行: <key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOr

这可能是几个线程的重复,但我找到的解决此问题的解决方案对我不起作用。我的应用程序总是以纵向模式启动,即使我的APP-Info.PList中有以下几行:

    <key>UISupportedInterfaceOrientations~ipad</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
ui支持的界面方向~ipad
UIInterfaceOrientationPortrait
UIInterfaceOrientation上下方向图
UIInterface方向和左视图
UIInterfaceOrientationAndscapeRight
谢谢你的帮助

[编辑1]以更清楚地了解问题


应用程序实际上是在横向模式下启动的,但当我在rootViewController的viewDidLoad方法中记录屏幕大小时,它会给出纵向模式的大小。这是实际的问题,因为我想在主视图中添加一个子视图,其大小取决于屏幕的方向。我希望我更清楚。

您的AppDelegate具有
shouldAutorotateToInterfaceOrientation:
方法。如果返回YES,则允许任何方向。 试试这个:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
    // Returns only Landscape Mode
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

希望这有助于

确保您没有手动旋转uiview,如果没有在xib中检查尺寸检查器的属性(我可能正在旋转,但不适应新的尺寸)

我遇到了同样的问题,这为我解决了这个问题:

    self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

它仍然不起作用。当我在横向模式下启动应用程序并在viewDidLoad方法中记录屏幕大小时,它给出的宽度:768.000000/高度:1004.000000…大小取决于视图的属性检查器中设置的方向。但我不想将其设置为横向或纵向。我想让应用程序检测iPad的方向。你在VIEWWILLEXPENCE方法上得到相同的结果吗?