iOS: Ensure root view controller always matches size of containing window
Change-Id: I249d847a1f4785b3e63e46759baed340b0d6362e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>bb10
parent
df734769d3
commit
e3a72a8aee
|
|
@ -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
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue