diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-07-28 12:52:19 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-09-24 11:52:58 +0200 |
commit | e3a72a8aee174dc51eff598c45d426d45c1d83aa (patch) | |
tree | aa2c172358b7b420f7ceab678d36d0b19adfb9f6 /src/plugins/platforms | |
parent | df734769d39ba98be798c0657174bff45c1ccf6f (diff) |
iOS: Ensure root view controller always matches size of containing window
Change-Id: I249d847a1f4785b3e63e46759baed340b0d6362e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/ios/qiosviewcontroller.mm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 782c98f66e..7079cd73eb 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -80,6 +80,41 @@ window->handle()->setWindowState(window->windowState()); } +// Even if the root view controller has both wantsFullScreenLayout and +// extendedLayoutIncludesOpaqueBars enabled, iOS will still push the root +// view down 20 pixels (and shrink the view accordingly) when the in-call +// statusbar is active (instead of updating the topLayoutGuide). Since +// we treat the root view controller as our screen, we want to reflect +// the in-call statusbar as a change in available geometry, not in screen +// geometry. To simplify the screen geometry mapping code we reset the +// view modifications that iOS does and take the statusbar height +// explicitly into account in QIOSScreen::updateProperties(). + +- (void)setFrame:(CGRect)newFrame +{ + [super setFrame:CGRectMake(0, 0, CGRectGetWidth(newFrame), CGRectGetHeight(self.window.bounds))]; +} + +- (void)setBounds:(CGRect)newBounds +{ + CGRect transformedWindowBounds = [self convertRect:self.window.bounds fromView:self.window]; + [super setBounds:CGRectMake(0, 0, CGRectGetWidth(newBounds), CGRectGetHeight(transformedWindowBounds))]; +} + +- (void)setCenter:(CGPoint)newCenter +{ + Q_UNUSED(newCenter); + [super setCenter:self.window.center]; +} + +- (void)didMoveToWindow +{ + // The initial frame computed during startup may happen before the view has + // a window, meaning our calculations above will be wrong. We ensure that the + // frame is set correctly once we have a window to base our calulations on. + [self setFrame:self.window.bounds]; +} + @end // ------------------------------------------------------------------------- |