From 62729d5dadecd992567ddc5fce74056b8f5ab4f0 Mon Sep 17 00:00:00 2001 From: "Marko B. Ludolph" Date: Fri, 22 Dec 2017 02:14:36 +0100 Subject: [PATCH] [iOS] Redirect PreferredStatusBarStyle to the Child View Controller (#1175) --- .../PlatformRenderer.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs b/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs index 1e3eebbf6..cebeecb0d 100644 --- a/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.Linq; using UIKit; using Xamarin.Forms.PlatformConfiguration.iOSSpecific; @@ -95,6 +96,17 @@ namespace Xamarin.Forms.Platform.iOS _modal = null; base.Dispose(disposing); } + + public override void ViewDidLoad() + { + base.ViewDidLoad(); + SetNeedsStatusBarAppearanceUpdate(); + } + + public override UIViewController ChildViewControllerForStatusBarStyle() + { + return ChildViewControllers?.LastOrDefault(); + } } internal class PlatformRenderer : UIViewController @@ -129,6 +141,11 @@ namespace Xamarin.Forms.Platform.iOS return (UIViewController)Platform.GetRenderer(this.Platform.Page); } + public override UIViewController ChildViewControllerForStatusBarStyle() + { + return ChildViewControllers?.LastOrDefault(); + } + public override bool ShouldAutorotate() { if ((ChildViewControllers != null) && (ChildViewControllers.Length > 0)) @@ -167,5 +184,11 @@ namespace Xamarin.Forms.Platform.iOS Platform.WillAppear(); base.ViewWillAppear(animated); } + + public override void ViewDidLoad() + { + base.ViewDidLoad(); + SetNeedsStatusBarAppearanceUpdate(); + } } } \ No newline at end of file