3

伙计们!

需要一些紧急的见解。我的问题是,即使 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 上进行测试,但它不起作用。尝试了一些东西,但直到现在还没有运气。

干杯。

4

1 回答 1

6

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

纵向锁定

于 2013-05-13T00:01:37.000 回答