此 iOS 平台特定功能用于设置 TabbedPage 上的选项卡栏的半透明模式。 通过将 TabbedPage.TranslucencyMode 可绑定属性设置为 TranslucencyMode 枚举值在 XAML 中使用它:
<TabbedPage ...
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
ios:TabbedPage.TranslucencyMode="Opaque">
...
</TabbedPage>
或者,可以使用 Fluent API 从 C# 使用它:
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
...
On<iOS>().SetTranslucencyMode(TranslucencyMode.Opaque);
该 TabbedPage.On<iOS> 方法指定此平台特定仅在 iOS 上运行。 在 Xamarin.Forms.PlatformConfiguration.iOSSpecific 命名空间中,TabbedPage.SetTranslucencyMode 方法通过指定以下 TranslucencyMode 枚举值之一设置 TabbedPage 上选项卡栏的半透明模式:
Default,用于将选项卡栏设置为其默认的半透明模式。 这是TabbedPage.TranslucencyMode属性的默认值。Translucent,用于将选项卡栏设置为半透明。Opaque,用于将选项卡栏设置为不透明。
此外,GetTranslucencyMode 方法还可用于检索应用于 TabbedPage 的 TranslucencyMode 枚举当前值。
结果是可以设置 TabbedPage 上选项卡栏的半透明模式:
