void UpdateFlyoutLayoutBehavior(CGSize newBounds) { FlyoutPage flyoutDetailPage = _flyoutPage ?? Element as FlyoutPage; if (flyoutDetailPage == null) { return; } bool isPortrait = newBounds.Height > newBounds.Width; var previous = PreferredDisplayMode; switch (flyoutDetailPage.FlyoutLayoutBehavior) { #pragma warning disable CA1416 // TODO: UISplitViewControllerDisplayMode.AllVisible, PrimaryHidden is unsupported on: 'ios' 14.0 and late case FlyoutLayoutBehavior.Split: PreferredDisplayMode = UISplitViewControllerDisplayMode.AllVisible; break; case FlyoutLayoutBehavior.Popover: PreferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryHidden; break; case FlyoutLayoutBehavior.SplitOnPortrait: PreferredDisplayMode = (isPortrait) ? UISplitViewControllerDisplayMode.AllVisible : UISplitViewControllerDisplayMode.PrimaryHidden; break; case FlyoutLayoutBehavior.SplitOnLandscape: PreferredDisplayMode = (!isPortrait) ? UISplitViewControllerDisplayMode.AllVisible : UISplitViewControllerDisplayMode.PrimaryHidden; break; #pragma warning restore CA1416 default: PreferredDisplayMode = UISplitViewControllerDisplayMode.Automatic; break; } if (previous == PreferredDisplayMode) { return; } if (!FlyoutPageController.ShouldShowSplitMode) { FlyoutPageController.CanChangeIsPresented = true; } FlyoutPage.UpdateFlyoutLayoutBehavior(); }
public override void WillRotate(UIInterfaceOrientation toInterfaceOrientation, double duration) { // I tested this code on iOS9+ and it's never called if (!Forms.IsiOS9OrNewer) { if (!FlyoutPage.ShouldShowSplitMode && IsFlyoutVisible) { FlyoutPage.CanChangeIsPresented = true; PreferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryHidden; PreferredDisplayMode = UISplitViewControllerDisplayMode.Automatic; } FlyoutPage.UpdateFlyoutLayoutBehavior(); MessagingCenter.Send <IVisualElementRenderer>(this, NavigationRenderer.UpdateToolbarButtons); } base.WillRotate(toInterfaceOrientation, duration); }