代码之家  ›  专栏  ›  技术社区  ›  Cocoa Dev

横向模式:翻转iPad时翻转图像

  •  0
  • Cocoa Dev  · 技术社区  · 15 年前

    苹果展示了ipad的照片。在他们的演示中,他们说你可以翻转ipad,它可以翻转图像。

    这一成果是如何取得的?

    我整天都在读关于界面定向的书,我迷路了

    任何帮助都将不胜感激。

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
    //  NSLog(@"orientation: %@", [orientation )
    if(orientation==UIInterfaceOrientationPortrait ||orientation==UIInterfaceOrientationPortraitUpsideDown) {
        //Code
        return NO;
    }  
    if (orientation==UIInterfaceOrientationLandscapeRight ||orientation==UIInterfaceOrientationLandscapeLeft ) {
        //Code
        return YES;
    }
    return NO;
    }
    
    1 回复  |  直到 15 年前
        1
  •  0
  •   Paul Lynch    15 年前

    在uiviewcontroller子类中实现:

    - (BOOL)shouldAutorotateToDeviceOrientation:... {
        Return YES;
    }
    

    大多数时候uikit都是为你管理的。