视图在iOS模拟器中被倒置绘制,未正确检测到状态栏方向



我在iPad上绘制的视图只支持横向,但有时在iOS模拟器中,视图会倒置绘制,iPad状态栏处于纵向模式。当我在模拟器中旋转设备时,一切都正常,只是初始负载很奇怪。我正在使用CGRect设置我的视图,并使用标准的iOS坐标系。

我的自转方法:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) | (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}

这是代码片段中的拼写错误吗;使用"||",而不是"|",所以:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
  return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}

最新更新