lib/ios: fix mising rootViewController in hello_ios
authorAlexis Laferrière <alexis.laf@xymus.net>
Tue, 9 Feb 2016 13:33:29 +0000 (08:33 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 9 Feb 2016 19:41:46 +0000 (14:41 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/ios/examples/.gitignore [new file with mode: 0644]
lib/ios/examples/hello_ios.nit

diff --git a/lib/ios/examples/.gitignore b/lib/ios/examples/.gitignore
new file mode 100644 (file)
index 0000000..43a4f39
--- /dev/null
@@ -0,0 +1 @@
+hello_ios.app
index 5a50230..c5d6c8a 100644 (file)
@@ -37,8 +37,8 @@ redef class AppDelegate
                NSLog(@"Hello World!");
 
                // Display "Hello world!" on the screen
-               self.window = [[UIWindow alloc] initWithFrame:
-               [[UIScreen mainScreen] bounds]];
+               CGRect frame = [[UIScreen mainScreen] bounds];
+               self.window = [[UIWindow alloc] initWithFrame: frame];
                self.window.backgroundColor = [UIColor whiteColor];
 
                UILabel *label = [[UILabel alloc] init];
@@ -46,6 +46,10 @@ redef class AppDelegate
                label.center = CGPointMake(100, 100);
                [label sizeToFit];
 
+               // As with `self.window` we must set a `rootViewController`
+               self.window.rootViewController = [[UIViewController alloc]initWithNibName:nil bundle:nil];
+               self.window.rootViewController.view = label;
+
                [self.window addSubview: label];
                [self.window makeKeyAndVisible];