iOS8 Interface Rotation Methods not called

The viewWillTransitionToSize:withTransitionCoordinator: seems to only work if the interface is actually going to change size, meaning we have rotated 90 degrees. If you have a mask on your layout that only allows landscape, when rotation 180 degrees, the interface size doesn’t change, so this method doesn’t seem to be called.

I have worked around this in my app by instead registering to the UIDeviceOrientationDidChangeNotification notification like:

(In my view controller’s viewWillAppear):

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:nil];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

(An in my viewWillDisappear [remember to unsubscribe])

[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];

My deviceOrientationDidChange: looks like:

- (void)deviceOrientationDidChange:(NSNotification *)notification {
    UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
    [self willRotateToInterfaceOrientation:orientation duration:1.0];
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)