0

在我的 iphone 应用程序中,我通过以下方法返回了是,它可以工作并且屏幕正在旋转,但是当它处于横向模式时,内容不适合屏幕

以下是我使用的代码

  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
         return YES;

    }

以下是我的输出在此处输入图像描述

旋转时如何使屏幕内容适合屏幕尺寸,任何人都可以帮助我,谢谢,

4

2 回答 2

3

reset the views frame当设备即将旋转时,您应该这样做。这通常应该在willRotateToInterfaceOrientation方法中完成。

您也可以简单地使用autoResizingMaskwhich 将在其 superView 框架更改时自动调整视图大小。

// Add this line in loadView method
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | 
                             UIViewAutoresizingFlexibleHeight;
于 2011-08-31T12:21:48.310 回答
0

阅读本教程:

http://www.shinstudio.com/blog/programming/rotating-view-in-iphone-app/

实施willRotateToInterfaceOrientation将是解决方案

于 2011-08-31T12:19:47.500 回答