代码之家  ›  专栏  ›  技术社区  ›  Jaka Jančar

UI界面方向LandscapeLeft和UI界面方向landscapeRight是否颠倒?

  •  5
  • Jaka Jančar  · 技术社区  · 16 年前

    UIInterfaceOrientationLandscapeLeft

    该设备处于横向模式,设备直立,主页按钮在右侧。

    UIInterfaceOrientationLandscapeRight

    + (NSString *)NSStringFromUIInterfaceOrientation:(UIInterfaceOrientation)o
    {
        switch (o) {
            case UIInterfaceOrientationPortrait: return @"UIInterfaceOrientationPortrait";
            case UIInterfaceOrientationPortraitUpsideDown: return @"UIInterfaceOrientationPortraitUpsideDown";
            case UIInterfaceOrientationLandscapeLeft: return @"UIInterfaceOrientationLandscapeLeft";
            case UIInterfaceOrientationLandscapeRight: return @"UIInterfaceOrientationLandscapeRight";
        }
        return nil;
    }
    
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
    {
        NSLog(@"Should: %@", [[self class] NSStringFromUIInterfaceOrientation:toInterfaceOrientation]);
        return YES;
    }    
    

    我将上述代码粘贴到默认的基于导航的应用程序模板的RootViewController.m中。

    跟进: bug 7216046 .

    1 回复  |  直到 16 年前
        1
  •  1
  •   Tim    16 年前

    你确定你正确阅读了文档吗?请注意,主页按钮的位置和方向值为 对立面 -也就是说, UIInterfaceOrientationLandscapeLeft 表示主页按钮 正确的 侧面,以及 UIInterfaceOrientationLandscapeRight 表示主页按钮 侧。请确保您正在旋转设备以进行正确检查。

    编辑: 我已经确认了原始问题中提出的问题。看起来像个虫子,除非我也错过了什么。