【问题标题】:rotate my ios app using UIInterfacOrientation使用 UIInterfaceOrientation 旋转我的 ios 应用程序
【发布时间】:2013-08-17 11:26:49
【问题描述】:

我曾经允许在 ipad 中旋转我的 ios 应用程序:

我的问题是横向方向右侧的空白区域,但纵向方向很好。 我认为我设置了横向或纵向方向的条件并调整视图控制器的宽度,但我该如何调整呢?条件是什么?

请帮忙!

【问题讨论】:

  • 学习使用自动布局、布局检查器或布局自动调整大小
  • 如何使用它?你能给我举个例子吗
  • 你是如何绘制你的视图的?那是 UITableView 吗?你在做自定义绘图吗?您是在 Interface Builder 中安排内容还是以编程方式进行?

标签: iphone ios uiinterfaceorientation autorotate


【解决方案1】:

这里是宏 UIDeviceOrientationIsLandscape 和 UIDeviceOrientationIsPortrait

所以宁愿单独检查你也可以这样做......

if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation))
{
    // code for landscape orientation      
}
OR

 if (UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation))
 {
     // code for Portrait orientation       
 }

检查方向后。你可以申请条件。 也请阅读自动调整大小

【讨论】:

  • 你能告诉我我应该把它放在哪个方法中
  • 可以放到Viewdidload中
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-06-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-15
  • 2012-01-08
相关资源
最近更新 更多