lib/ios: fix `pop_window` on iOS
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 18 May 2016 18:47:51 +0000 (14:47 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Wed, 18 May 2016 19:41:41 +0000 (15:41 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/ios/ui/ui.nit

index acf3018..03ea1f1 100644 (file)
@@ -112,6 +112,19 @@ redef class App
                set_view_controller(app_delegate.window, window.native)
                super
        end
+
+       # Use iOS ` popViewControllerAnimated`
+       redef fun pop_window
+       do
+               window_stack.pop
+               pop_view_controller app_delegate.window
+               window.on_resume
+       end
+
+       private fun pop_view_controller(window: UIWindow) in "ObjC" `{
+               UINavigationController *navController = (UINavigationController*)window.rootViewController;
+               [navController popViewControllerAnimated: YES];
+       `}
 end
 
 redef class AppDelegate