I have a UIView which is supposed to cover the whole device (UIWindow) to support an image zoom in/out effect I\'m doing using core animation where a user taps a button on a
Another solution how I solved this problem.
Define the current Orientation:
@interface AJImageCollectionViewController (){
UIInterfaceOrientation _currentOrientation;
}
@end
Then check the orientation in the viewWillLayoutSubviews:
- (void)viewWillLayoutSubviews {
[self checkIfOrientationChanged];
}
- (void)checkIfOrientationChanged {
UIInterfaceOrientation newOrientation = [[UIApplication sharedApplication] statusBarOrientation];
BOOL newOrientationIsPortrait = UIInterfaceOrientationIsPortrait(newOrientation);
BOOL oldOrientationIsPortrait = UIInterfaceOrientationIsPortrait(_currentOrientation);
// Check if the orientation is the same as the current
if(newOrientationIsPortrait != oldOrientationIsPortrait){
_currentOrientation = newOrientation;
// Do some stuff with the new orientation
}
}