diff --git a/Xamarin.Forms.Platform.iOS/Forms.cs b/Xamarin.Forms.Platform.iOS/Forms.cs index c44bb0e59..9c7888f46 100644 --- a/Xamarin.Forms.Platform.iOS/Forms.cs +++ b/Xamarin.Forms.Platform.iOS/Forms.cs @@ -34,6 +34,7 @@ namespace Xamarin.Forms static bool? s_isiOS9OrNewer; static bool? s_isiOS10OrNewer; static bool? s_isiOS11OrNewer; + static bool? s_respondsTosetNeedsUpdateOfHomeIndicatorAutoHidden; #endif #if __MOBILE__ @@ -67,6 +68,16 @@ namespace Xamarin.Forms return s_isiOS11OrNewer.Value; } } + + internal static bool RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden + { + get + { + if (!s_respondsTosetNeedsUpdateOfHomeIndicatorAutoHidden.HasValue) + s_respondsTosetNeedsUpdateOfHomeIndicatorAutoHidden = new UIViewController().RespondsToSelector(new ObjCRuntime.Selector("setNeedsUpdateOfHomeIndicatorAutoHidden")); + return s_respondsTosetNeedsUpdateOfHomeIndicatorAutoHidden.Value; + } + } #endif static IReadOnlyList s_flags; diff --git a/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs b/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs index 944a35239..07bb95838 100644 --- a/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs @@ -104,7 +104,7 @@ namespace Xamarin.Forms.Platform.iOS { base.ViewDidLoad(); SetNeedsStatusBarAppearanceUpdate(); - if (Forms.IsiOS11OrNewer) + if (Forms.RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden) SetNeedsUpdateOfHomeIndicatorAutoHidden(); } @@ -199,7 +199,7 @@ namespace Xamarin.Forms.Platform.iOS { base.ViewDidLoad(); SetNeedsStatusBarAppearanceUpdate(); - if (Forms.IsiOS11OrNewer) + if (Forms.RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden) SetNeedsUpdateOfHomeIndicatorAutoHidden(); } } diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs index 50ef3197b..a1b442b9a 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs @@ -231,7 +231,7 @@ namespace Xamarin.Forms.Platform.iOS UpdateBarTextColor(); UpdateUseLargeTitles(); UpdateHideNavigationBarSeparator(); - if (Forms.IsiOS11OrNewer) + if (Forms.RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden) SetNeedsUpdateOfHomeIndicatorAutoHidden(); // If there is already stuff on the stack we need to push it diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs index d74449e8b..7b2f314a4 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs @@ -176,7 +176,7 @@ namespace Xamarin.Forms.Platform.iOS _appeared = true; UpdateStatusBarPrefersHidden(); - if(Forms.IsiOS11OrNewer) + if(Forms.RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden) SetNeedsUpdateOfHomeIndicatorAutoHidden(); if (Element.Parent is CarouselPage) @@ -439,7 +439,7 @@ namespace Xamarin.Forms.Platform.iOS void UpdateHomeIndicatorAutoHidden() { - if (Element == null || !Forms.IsiOS11OrNewer) + if (Element == null || !Forms.RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden) return; SetNeedsUpdateOfHomeIndicatorAutoHidden(); diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs index 988614578..1434bc331 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs @@ -339,7 +339,7 @@ namespace Xamarin.Forms.Platform.iOS _detailController.AddChildViewController(detailRenderer.ViewController); SetNeedsStatusBarAppearanceUpdate(); - if (Forms.IsiOS11OrNewer) + if (Forms.RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden) SetNeedsUpdateOfHomeIndicatorAutoHidden(); }