Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIDeviceOrientationDidChangeNotification working for iDevice 4 and under but not iDevice 5

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.

like image 937
Felipe Avatar asked Jan 30 '26 20:01

Felipe


1 Answers

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

like image 137
Steph Sharp Avatar answered Feb 01 '26 13:02

Steph Sharp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!