代码之家  ›  专栏  ›  技术社区  ›  mahboudz

如何选择uiInterfaceOrientationLandscapeRight或uiInterfaceOrientationLandscapeLeft?

  •  0
  • mahboudz  · 技术社区  · 15 年前

    我有两个应用程序,它们都迫使用户在横向模式下使用iPhone,以便拥有更宽的屏幕,而不是更高的屏幕。我在plist文件中选择了uiInterfaceOrientationLandscapeRight,因为我喜欢用右手拇指按住iPhone按钮。一些用户希望在uiInterfaceOrientationLandscapeLeft中启动应用程序,因为他们更喜欢以另一种方式进行。

    考虑到该值存储在plist文件中,我认为无论如何我都不能保存用户对此设置的首选项,并在启动时将其用于显示default.png。

    我想我还是会问,看看这里有没有人找到一种方法来保存用户的屏幕方向偏好,并在那个方向上打开应用程序。请注意,最大的挑战是default.png,这是给用户第一条线索,告诉他们方向是什么。之后我可以切换到他们的最后一个方向,但到那时,默认的.png图形将迫使用户将iPhone转到指定的方向。

    1 回复  |  直到 15 年前
        1
  •  1
  •   Jason Plank Maksim Kondratyuk    13 年前

    设置检查并使用:

    -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        // Return YES for supported orientations
        return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    }