summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-08-01 13:54:45 +0200
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-09-24 11:53:19 +0200
commit28a57799ce210c4050e6cf4fc7939f8ba611789d (patch)
tree9609f721e63da80fb980d441b4e85cb2eed72611
parentf14d86c0f9fee9e5c52a5d1e857eb19c93cfed7e (diff)
iOS: Don't update screen properties for statusbar frame while rotating
The rotation will already result in laying out of the root viewcontroller, so we don't need to send explicit geometry changes for the statubar change. The properties of the screen at that point are also not consistent, as the screen is about to rotate. Change-Id: I1b45bee1c1224ca56f9e37068d68c4ee1bfeb9b6 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.h2
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.mm25
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,