【问题标题】:Converting View from Landscape to Portrait?将视图从横向转换为纵向?
【发布时间】:2012-09-21 19:37:55
【问题描述】:

我已经开发了横向模式的应用程序,现在客户要求在横向和纵向模式下构建。

如何将横向视图转换为纵向视图?

现在我将这段代码用于横向视图:

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{

 return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight);

 }

请帮帮我....

提前谢谢:)

【问题讨论】:

    标签: objective-c ios cocoa-touch uiinterfaceorientation


    【解决方案1】:

    简单,支持所有方向只需返回YESshouldAutorotateToInterfaceOrientation

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
    {
        return YES;
        //Or to support all but portrait upside down
        return interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
    }
    

    【讨论】:

      【解决方案2】:

      了解如何使用自动调整大小的蒙版。它们很简单,但在大多数情况下非常强大。

      【讨论】:

        【解决方案3】:

        NSPostWhenIdle 是对的。您只需要返回 yes shouldAutorotateToInterfaceOrientation。这样您就可以支持所有方向。看看通过 XIB 调整属性大小。这也将使您的工作变得轻松。

        【讨论】:

          猜你喜欢
          • 2020-02-21
          • 2023-01-30
          • 2023-04-02
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-07-11
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多