【问题标题】:iPhone - Interface Orientation reversed?iPhone - 界面方向反转?
【发布时间】:2010-02-20 15:59:18
【问题描述】:

您好,我有这段代码...

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

- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{

  if(UIInterfaceOrientationIsPortrait(interfaceOrientation)){
    // WTF, this runs when I change to Landscape
  } else {
    // this runs when I change to Portrait??? shouldn't it be the contrary?
  }
}

如您所见,代码是反向运行的,我的意思是,当我将设备更改为纵向时应该运行的部分,代码的横向部分运行,反之亦然。

当我转动设备时,self.view 会旋转。

这个 UIInterfaceOrientationIsPortrait 是在测试界面在旋转之前的状态还是我遗漏了什么?

感谢您的帮助。

【问题讨论】:

    标签: iphone iphone-sdk-3.0 ipad


    【解决方案1】:

    请注意,该方法名为 didRotateFromInterfaceOrientation,因此interfaceOrientation 参数自然包含旧方向,而不是新方向。

    【讨论】:

      猜你喜欢
      • 2014-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-16
      • 2010-10-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多