Ability to hide HomeIndicator from iPhone X, XR, XS on given page
add to Xamarin.Forms.Platform.iOS/PlatformRenderer.cs
public override UIViewController ChildViewControllerForHomeIndicatorAutoHidden
{
get
{
return (UIViewController)Platform.GetRenderer(this.Platform.Page);
}
}
...
public override void ViewDidLoad()
{
...
SetNeedsUpdateOfHomeIndicatorAutoHidden();
}
and add new bindable property to page and consume it in Page Renderer
[assembly: ExportRenderer(typeof(MyPage), typeof(HomeIndicatorRenderer))]
namespace MyApp
{
public class HomeIndicatorRenderer : PageRenderer
{
// new property
public override bool PrefersHomeIndicatorAutoHidden => this.Element.HomeIndicatorAutoHiddenIOS;
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
SetNeedsUpdateOfHomeIndicatorAutoHidden();
}
}
}
Applicable to all pages where user don't want to be distracted by home indicator, e.g. full-screen gallery window or full-screen player window.
Originated here: https://stackoverflow.com/questions/54743272/hide-home-indicator-for-iphone-x-in-xamarin-forms-page/54747722
There was already a PR for it a while ago (#1515) but this was closed for lack of spec.
I would suggest making it a platform-specific though, similar to how it works for the iOS status bar.
This would mean
Added:
Page iOS Platform Specific
public static readonly BindableProperty HomeIndicatorAutoHiddenProperty = BindableProperty.Create(nameof(HomeIndicatorAutoHidden), typeof(bool), typeof(Page), false);
public static bool GetHomeIndicatorAutoHidden(BindableObject element)
public static void SetHomeIndicatorAutoHidden(BindableObject element, bool value)
public static IPlatformElementConfiguration<iOS, FormsElement> SetHomeIndicatorAutoHidden(this IPlatformElementConfiguration<iOS, FormsElement> config, bool value)
public static bool HomeIndicatorAutoHidden(this IPlatformElementConfiguration<iOS, FormsElement> config)
Is it possible to hide the indicator in all application? At the moment, I have this property on my BasecontentPage, however, everytime I do an action, or change page, the indicator is always appearing and disappearing (which is far from perfect)
Most helpful comment
Originated here: https://stackoverflow.com/questions/54743272/hide-home-indicator-for-iphone-x-in-xamarin-forms-page/54747722
There was already a PR for it a while ago (#1515) but this was closed for lack of spec.
I would suggest making it a platform-specific though, similar to how it works for the iOS status bar.
This would mean
API Changes
Added:
Page iOS Platform Specific