-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Page platform-specifics on iOS (#2565)
* Page platform-specifics on iOS. * Add to TOC. * Fix xrefs. * Edits.
- Loading branch information
1 parent
b463056
commit 5d27d22
Showing
6 changed files
with
88 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+14 KB
.../ios/platform-specifics/media/page-home-indicator/home-indicator-visibility.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+71.9 KB
docs/ios/platform-specifics/media/page-status-bar-visibility/hide-status-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: "Home indicator visibility on iOS" | ||
description: "This article explains how to consume the iOS platform-specific that sets the visibility of the home indicator on a page." | ||
ms.date: 10/10/2024 | ||
--- | ||
|
||
# Home indicator visibility on iOS | ||
|
||
This iOS platform-specific sets the visibility of the home indicator on a <xref:Microsoft.Maui.Controls.Page>. It's consumed in XAML by setting the `Page.PrefersHomeIndicatorAutoHidden` bindable property to a `boolean`: | ||
|
||
```xaml | ||
<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: | ||
|
||
```csharp | ||
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 | ||
<xref:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.Page.SetPrefersHomeIndicatorAutoHidden%2A?displayProperty=nameWithType> method, in the <xref:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific> namespace, controls the visibility of the home indicator. In addition, the <xref:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.Page.PrefersHomeIndicatorAutoHidden%2A?displayProperty=nameWithType> method can be used to retrieve the visibility of the home indicator. | ||
|
||
The result is that the visibility of the home indicator on a <xref:Microsoft.Maui.Controls.Page> can be controlled: | ||
|
||
:::image type="content" source="media/page-home-indicator/home-indicator-visibility.png" alt-text="Home indicator visibility on an iOS page."::: | ||
|
||
> [!NOTE] | ||
> This platform-specific can be applied to <xref:Microsoft.Maui.Controls.ContentPage>, <xref:Microsoft.Maui.Controls.FlyoutPage>, <xref:Microsoft.Maui.Controls.NavigationPage>, <xref:Microsoft.Maui.Controls.Shell>, and <xref:Microsoft.Maui.Controls.TabbedPage> objects. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: "Page status bar visibility on iOS" | ||
description: "This article explains how to consume the iOS platform-specific that sets the visibility of the status bar on a Page." | ||
ms.date: 10/10/2024 | ||
--- | ||
|
||
# Page status bar visibility on iOS | ||
|
||
This iOS platform-specific is used to set the visibility of the status bar on a <xref:Microsoft.Maui.Controls.Page>, and it includes the ability to control how the status bar enters or leaves the <xref:Microsoft.Maui.Controls.Page>. It's consumed in XAML by setting the `Page.PrefersStatusBarHidden` attached property to a value of the <xref:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.StatusBarHiddenMode> enumeration, and optionally the `Page.PreferredStatusBarUpdateAnimation` attached property to a value of the <xref:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.UIStatusBarAnimation> enumeration: | ||
|
||
```xaml | ||
<ContentPage ... | ||
xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls" | ||
ios:Page.PrefersStatusBarHidden="True" | ||
ios:Page.PreferredStatusBarUpdateAnimation="Fade"> | ||
... | ||
</ContentPage> | ||
``` | ||
|
||
Alternatively, it can be consumed from C# using the fluent API: | ||
|
||
```csharp | ||
using Microsoft.Maui.Controls.PlatformConfiguration; | ||
using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; | ||
... | ||
|
||
On<iOS>().SetPrefersStatusBarHidden(StatusBarHiddenMode.True) | ||
.SetPreferredStatusBarUpdateAnimation(UIStatusBarAnimation.Fade); | ||
``` | ||
|
||
The `Page.On<iOS>` method specifies that this platform-specific will only run on iOS. The <xref:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.Page.SetPrefersStatusBarHidden%2A?displayProperty=nameWithType> method, in the <xref:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific> namespace, is used to set the visibility of the status bar on a <xref:Microsoft.Maui.Controls.Page> by specifying one of the <xref:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.StatusBarHiddenMode> enumeration values: `Default`, `True`, or `False`. The `StatusBarHiddenMode.True` and `StatusBarHiddenMode.False` values set the status bar visibility regardless of device orientation, and the `StatusBarHiddenMode.Default` value hides the status bar in a vertically compact environment. | ||
|
||
The result is that the visibility of the status bar on a <xref:Microsoft.Maui.Controls.Page> can be set: | ||
|
||
:::image type="content" source="media/page-status-bar-visibility/hide-status-bar.png" alt-text="Status bar visibility on an iOS page."::: | ||
|
||
> [!NOTE] | ||
> On a <xref:Microsoft.Maui.Controls.TabbedPage>, the specified <xref:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.StatusBarHiddenMode> enumeration value will also update the status bar on all child pages. On all other <xref:Microsoft.Maui.Controls.Page>-derived types, the specified <xref:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.StatusBarHiddenMode> enumeration value will only update the status bar on the current page. | ||
The <xref:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.Page.SetPreferredStatusBarUpdateAnimation%2A?displayProperty=nameWithType> method is used to set how the status bar enters or leaves the <xref:Microsoft.Maui.Controls.Page> by specifying one of the <xref:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.UIStatusBarAnimation> enumeration values: `None`, `Fade`, or `Slide`. If the `Fade` or `Slide` enumeration value is specified, a 0.25 second animation executes as the status bar enters or leaves the <xref:Microsoft.Maui.Controls.Page>. |