【问题标题】:Which method will be called when the iOS device turn into Landscape mode?iOS 设备进入横向模式时会调用哪个方法?
【发布时间】:2010-11-02 01:59:49
【问题描述】:

我知道我可以在 shouldAutorotateToInterfaceOrientation 中返回 YES 以支持横向模式。但是我想显示一个新视图,当用户将设备变为横向模式时,我该怎么做?谢谢你。

【问题讨论】:

    标签: iphone objective-c ios4


    【解决方案1】:

    关注本次活动UIDeviceOrientationDidChangeNotification

    [[NSNotificationCenter defaultCenter] addObserver:self 
               selector:@selector(orientationDidChange:)
               name:UIDeviceOrientationDidChangeNotification object:nil];
    

    【讨论】:

      【解决方案2】:

      对于这种情况,一个有用的技术是,呈现一个新的模态视图控制器,并从当前视图“淡出”过渡。正如 Aaron 之前提到的,您可以对 UIDeviceOrientationDidChangeNotification 做出反应。

      【讨论】:

        【解决方案3】:
        [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多