From 19de726725dc123f478ecb2b122d03862c725650 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 7 Nov 2012 09:31:00 +0100 Subject: iOS: create top-level UIWindow and UIViewController MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create a UIWIndow with a view controller and a view where we can reparent our QIOSWindow views inside. Change-Id: Ic90707d3ebe1af970a3aa2aa0f8c0f4be192456a Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosapplicationdelegate.mm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/plugins/platforms/ios/qiosapplicationdelegate.mm') diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index d88b2b83f1..6fed4c1a23 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -40,6 +40,7 @@ ****************************************************************************/ #import "qiosapplicationdelegate.h" +#include "qioswindow.h" #include @implementation QIOSApplicationDelegate @@ -48,7 +49,24 @@ { Q_UNUSED(application) Q_UNUSED(launchOptions) + + // If this application delegate is instanciated, it means that + // this plugin also created UIApplication. We then also create a + // window with a view controller, and set all QWindow views + // as children of the controller view: self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + UIViewController *controller = [[UIViewController alloc] init]; + self.window.rootViewController = controller; + controller.view = [[UIView alloc] init]; + + QWindowList windows = QGuiApplication::topLevelWindows(); + for (int i=0; i(windows[i]->handle())) { + UIView *winView = w->nativeView(); + if (winView && !winView.superview) + [controller.view addSubview:winView]; + } + } // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; -- cgit v1.2.3