diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/ios/qiosviewcontroller.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qiosviewcontroller.mm | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.h b/src/plugins/platforms/ios/qiosviewcontroller.h index 5e95cdd3ee..cd9de76269 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.h +++ b/src/plugins/platforms/ios/qiosviewcontroller.h @@ -47,6 +47,8 @@ class QIOSScreen; QIOSScreen *m_screen; } +@property (nonatomic, assign) BOOL changingOrientation; + - (id)initWithQIOSScreen:(QIOSScreen *)screen; - (BOOL)prefersStatusBarHidden; @end diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 9a5d5c3691..1c06228e81 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -145,6 +145,8 @@ && [UIApplication sharedApplication].statusBarStyle == UIStatusBarStyleDefault) [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent]; #endif + + self.changingOrientation = NO; } return self; @@ -195,6 +197,21 @@ } #endif +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration +{ + Q_UNUSED(orientation); + Q_UNUSED(duration); + + self.changingOrientation = YES; +} + +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)orientation +{ + Q_UNUSED(orientation); + + self.changingOrientation = NO; +} + - (void)willChangeStatusBarFrame:(NSNotification*)notification { Q_UNUSED(notification); @@ -202,6 +219,14 @@ if (self.view.window.screen != [UIScreen mainScreen]) return; + // Orientation changes will already result in laying out subviews, so we don't + // need to do anything extra for frame changes during an orientation change. + // Technically we can receive another actual statusbar frame update during the + // orientation change that we should react to, but to simplify the logic we + // use a simple bool variable instead of a ignoreNextFrameChange approach. + if (self.changingOrientation) + return; + // UIKit doesn't have a delegate callback for statusbar changes that's run inside the // animation block, like UIViewController's willAnimateRotationToInterfaceOrientation, // nor does it expose a constant for the duration and easing of the animation. However, |