From 7010da2e6274febf71db40a535ce1d0c4858f143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 24 Aug 2015 16:37:34 +0200 Subject: iOS: Make setFrame in desktop view take superview transforms into account MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An assumption we do for the QIOSDesktopManagerView is that it should always cover the whole UIWindow. To achieve that, we override setFrame to be stop any attempt from UIKit to make our view smaller, e.g. when the statusbar changes height. In case the view is not a direct child of the window, we need to take any transformations into account when computing the new frame. This happens e.g. during presentation of other view-controllers, where our view is temporarily reparented into a UITransitionView that may have a transform set. Task-number: QTBUG-47506 Change-Id: I388143f2cbb566541ffb1068443ce21e62ea2b42 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosviewcontroller.mm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/ios/qiosviewcontroller.mm') diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index a7068b9246..62f5387979 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -185,7 +185,14 @@ - (void)setFrame:(CGRect)newFrame { - [super setFrame:CGRectMake(0, 0, CGRectGetWidth(newFrame), CGRectGetHeight(self.window.bounds))]; + Q_UNUSED(newFrame); + Q_ASSERT(!self.window || self.window.rootViewController.view == self); + + // When presenting view controllers our view may be temporarily reparented into a UITransitionView + // instead of the UIWindow, and the UITransitionView may have a transform set, so we need to do a + // mapping even if we still expect to always be the root view-controller. + CGRect transformedWindowBounds = [self.superview convertRect:self.window.bounds fromView:self.window]; + [super setFrame:transformedWindowBounds]; } - (void)setBounds:(CGRect)newBounds -- cgit v1.2.3