iPad应用程序以横向模式启动 [英] iPad app to start in landscape mode

查看:96
本文介绍了iPad应用程序以横向模式启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了其他现有帖子,但没有一个符合我的要求。

I searched for other existing posts, but none of them satisfied my requirements.

这是我面临的问题,


  1. 我的应用程序支持模式,横向和纵向。

  2. 但我的第一个屏幕仅支持横向,因此应用程序必须从横向开始。

  3. 我为所有4个选项设置了支持方向

  4. 我已将初始界面方向设置为横向(左主页按钮)

  5. 在第一个屏幕的视图控制器中,我定义了以下内容

  1. My app supports both the Modes , landscape and portrait.
  2. But my first screen only supports Landscape , so the app must start in Landscape.
  3. I have set supported Orientation to all the 4 options
  4. I have set the Initial interface orientation to Landscape (left home button)
  5. In the view controller of the first screen i am defining the below




- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

    {
        return (interfaceOrientation != UIInterfaceOrientationPortrait);
    }


当我启动应用程序时,模拟器总是在肖像中打开,我的视图在纵向模式下全部搞砸了,因为它只是为景观设计的。
切换到横向后,设备仍处于此模式。

And when i start the app the simulator always opens in Portrait and my view is all messed up in the portrait mode , since it is designed only for the landscape. After the switch to the Landscape, the device remains in this mode.

任何人都可以帮我解决这个问题吗?

can anyone help me with the solution to avoid this ?

谢谢
Naveen

Thanks Naveen

编辑:


此信息可能会有所帮助,只有当我在Portrait中按住设备然后启动应用程序时才会遇到问题。

This info may be helpful , The problem is faced only when i hold the device in Portrait and then launch the app.

这不是这个问题的重复,仅适用于iPhone或iPad的横向模式

Its not the duplication of this question, Landscape Mode ONLY for iPhone or iPad

仅适用于iPhone或iPad的横向模式

我不希望我的应用只在横向,我只希望我的应用的第一个屏幕只在横向。

I do not want my app to be only in Landscape , i want only the first screen of my app to be only in Landscape.

推荐答案

我实现了问题的解决方法并解决了,

I achieved a workaround for the Problem and it solved ,

我创建了一个虚拟视图控制器并添加为Window的根视图控制器。

I created a dummy view controller and added as the root view controller of the Window.

在实施中添加了以下方法

Added the below method in the implementation

    -(void)viewDidAppear:(BOOL)animated
    {
        WelcomeScreen *welcomeScreen = [[[WelcomeScreen alloc] initWithNibName:@"WelcomeScreen" bundle:nil] autorelease];
        [self presentModalViewController:welcomeScreen animated:NO];
    }

现在它按预期工作。

这篇关于iPad应用程序以横向模式启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆