iOS 上的首頁指標可見度

Download Sample 下載範例

這個 iOS 平臺特定會設定 上 Page首頁指標的可見度。 將可繫結屬性設定 Page.PrefersHomeIndicatorAutoHiddenboolean,以在 XAML 中取用它:

<ContentPage ...
             xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
             ios:Page.PrefersHomeIndicatorAutoHidden="true">
    ...
</ContentPage>

或者,您可以使用 Fluent API 從 C# 取用它:

using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
...

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

方法 Page.On<iOS> 會指定此平台專屬只會在iOS上執行。 方法 Page.SetPrefersHomeIndicatorAutoHidden 會在 命名空間中 Xamarin.Forms.PlatformConfiguration.iOSSpecific 控制主指標的可見性。 此外, Page.PrefersHomeIndicatorAutoHidden 方法可以用來擷取主指標的可見性。

結果是可以控制上首頁指標 Page 的可見度:

Screenshot of home indicator visibility on an iOS page

注意

這個平臺特定專案可以套用至 ContentPageFlyoutPageNavigationPageTabbedPage 物件。