Вопрос

Dudes!

Need some urgent insight. My problem is that even though tests on iPhone 4/4S and iPod 4 rotate normally with this code here:

- (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];
}

but i'm testing on a iPod 5 and it doesn't work. tried some stuff but no luck till now.

cheers.

Это было полезно?

Решение

I had a similar issue with UIDeviceOrientationDidChangeNotification, where it worked fine on one device, but not another. After a bit of debugging I realised that I had Portrait Orientation Locked on the device, and this was causing the UIDeviceOrientationDidChangeNotification to not fire at all. Not sure if that's your issue, but it's something that's easy to overlook and worth checking.

Portrait Orientation Locked

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top