Bewerken

Delen via


Home indicator visibility on iOS

This iOS platform-specific sets the visibility of the home indicator on a Page. It's consumed in XAML by setting the Page.PrefersHomeIndicatorAutoHidden bindable property to a boolean:

<ContentPage ...
             xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls"
             ios:Page.PrefersHomeIndicatorAutoHidden="true">
    ...
</ContentPage>

Alternatively, it can be consumed from C# using the fluent API:

using Microsoft.Maui.Controls.PlatformConfiguration;
using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;
...

On<iOS>().SetPrefersHomeIndicatorAutoHidden(true);

The Page.On<iOS> method specifies that this platform-specific will only run on iOS. The Page.SetPrefersHomeIndicatorAutoHidden method, in the Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific namespace, controls the visibility of the home indicator. In addition, the Page.PrefersHomeIndicatorAutoHidden method can be used to retrieve the visibility of the home indicator.

The result is that the visibility of the home indicator on a Page can be controlled:

Home indicator visibility on an iOS page.

Note

This platform-specific can be applied to ContentPage, FlyoutPage, NavigationPage, Shell, and TabbedPage objects.