【问题标题】:UIDeviceOrientationDidChangeNotification working for iDevice 4 and under but not iDevice 5UIDeviceOrientationDidChangeNotification 适用于 iDevice 4 及以下但不适用于 iDevice 5
【发布时间】:2012-12-17 01:35:20
【问题描述】:

伙计们!

需要一些紧急的见解。 我的问题是,即使 iPhone 4/4S 和 iPod 4 上的测试在此处使用以下代码正常旋转:

- (void)initNotifications
{
    [[NSNotificationCenter defaultCenter] postNotificationName:@"setFreeOrientation" object:nil];

    [[UIDevice currentDevice]beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter]addObserver:self
                                            selector:@selector(didRotate:)
                                                name:UIDeviceOrientationDidChangeNotification
                                              object:Nil];
}

-(void)didRotate:(NSNotification*)notification
{
    [super rotateTopBars];
    [super rotateOptionsBar];
    [self rotateControlBar];
    [self rotatePlayer];
    [super rotateShareLayer];
}

但我在 iPod 5 上进行测试,但它不起作用。 尝试了一些东西,但直到现在都没有运气。

干杯。

【问题讨论】:

  • 看看this question,我相信它和你的问题几乎完全一样。

标签: iphone ios6 uiinterfaceorientation ipod-touch


【解决方案1】:

我在UIDeviceOrientationDidChangeNotification 上遇到了类似的问题,它在一台设备上运行良好,但在另一台设备上却不行。经过一番调试,我意识到我在设备上锁定了人像方向,这导致UIDeviceOrientationDidChangeNotification 根本无法触发。不确定这是否是您的问题,但它很容易被忽视且值得检查。

【讨论】:

  • 我想我一生都在寻找看不见的虫子……谢谢你的帮助!
  • 有没有办法通过编程方式解锁?
  • 这也是我的问题。没有意识到设备上的方向很久以前就被锁定了。 (测试设备)。谢谢!
猜你喜欢
  • 1970-01-01
  • 2016-06-18
  • 2015-11-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-06-07
  • 2017-01-12
相关资源
最近更新 更多