【问题标题】:UIInterfaceOrientation rotate along with the HearderUIInterfaceOrientation 随 Header 一起旋转
【发布时间】:2011-02-15 06:58:58
【问题描述】:

当我将模拟器从纵向旋转到横向时,标题没有旋转。我想使用 UIInterfaceOrientation 旋转标题和视图旋转。

【问题讨论】:

  • 请任何人指导我这样做。

标签: iphone cocoa-touch uiinterfaceorientation


【解决方案1】:

@renuga 我认为您需要在视图控制器中实现此方法。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    if(toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
        return YES;
    if(toInterfaceOrientation == UIInterfaceOrientationPortrait)
        return YES;
    return NO;
}

前往 IB 并点击如下所示的箭头。

你需要调整标签栏的位置

【讨论】:

  • @robin: 非常感谢您的快速回复。上面的代码根据方向旋转状态栏(仅)。我的意思不是旋转标题(可能是导航栏或工具栏)。
  • 它将旋转 IB 中的所有 UIView 对象,您可以显示您的 IB 快照
  • 请参考我的问题,我已编辑问题并添加我的 InterfaceBuilder 屏幕截图。谢谢
  • @robin:Hai robin 当我将模拟器从纵向(纵向模式它显示工具栏)旋转到横向模式时它不显示工具栏。我不知道为什么会这样。请帮我这样做。谢谢
  • Hai Robin ..当我单击您在屏幕截图中指定的箭头时,它仅在纵向模式下显示工具栏图像,并且在横向模式下不显示工具栏(工具栏的位置自动进入横向模式时更改)。在纵向模式下:X:0 y:0 W:320 H:44 在横向模式下X:0 y:-160 W:480 H:44。为什么会出现此问题,请帮助我解决这个。谢谢
猜你喜欢
  • 1970-01-01
  • 2023-04-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-17
  • 1970-01-01
相关资源
最近更新 更多