是否可以在 Xamarin.Forms 中创建这个新的 IOS 模态视图?

Is it possible to create this new IOS Modal View in Xamarin.Forms?

这就是我所说的:(这是从 Elgato 控制中心应用程序中获取的)

iPhone

before popup after popup

iPad

before popup after popup

感谢任何指点,谢谢!

我用Rg.Plugins.Popup写了一个例子。

这里是 xaml 代码:

<pages:PopupPage 
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
    xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
    x:Class="App2.Page1">
    <pages:PopupPage.Animation>
        <animations:ScaleAnimation
            PositionIn="Bottom"
            PositionOut="Bottom"      
            DurationIn="400"
            DurationOut="300"
            EasingIn="SinOut"
            EasingOut="SinIn"
            HasBackgroundAnimation="True"/>
    </pages:PopupPage.Animation>
    <StackLayout
        VerticalOptions="CenterAndExpand"
        HorizontalOptions="CenterAndExpand">
        <Frame CornerRadius="20"  HorizontalOptions="FillAndExpand" HeightRequest="200" >
            <StackLayout>
                <Label Text="This is popuppage"></Label>
                <Button Text="close" Clicked="Button_Clicked" VerticalOptions="EndAndExpand"></Button>
            </StackLayout>
        </Frame>
    </StackLayout>
</pages:PopupPage>

这里是cs代码:

[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class Page1 : Rg.Plugins.Popup.Pages.PopupPage
{
    public Page1()
    {
        InitializeComponent();
    }

    private async void Button_Clicked(object sender, EventArgs e)
    {
        await Navigation.PopPopupAsync();
    }
}

在Android的MainActivity中添加:

Rg.Plugins.Popup.Popup.Init(this);

在IOS的AppDelegate中添加:

Rg.Plugins.Popup.Popup.Init();

这是 运行 屏幕截图:

答案取决于您对术语的定义。

如果您认为仅使用 Xamarin.Forms 并使用您显示的本机弹出窗口,答案是否定的。

如果你不介意使用一些非原生的弹窗,那么你可以看看李文旭的回答(但我会说它不太符合你的要求)。

最终 Xamarin.Forms 建立在 Xamarin.iOS 之上,这样的事情是可能的。您可以访问 Xamarin.iOS 项目,从技术上讲,您可以做到这一点。我认为这应该可以通过自定义渲染器实现。