Xamarin 如何从右到左使用PopAsync页面导航动画?
请告诉我如何在调用PopAsync()时应用从右到左的动画页面效果 我的代码:Xamarin 如何从右到左使用PopAsync页面导航动画?,xamarin,xamarin.ios,xamarin.forms,Xamarin,Xamarin.ios,Xamarin.forms,请告诉我如何在调用PopAsync()时应用从右到左的动画页面效果 我的代码: async void LogOut_Tapped(object sender, EventArgs e) { await Navigation.PopAsync(); } 请帮帮我。PopAsync有一个接受布尔值以指示是否应设置动画的。如果您使用Navigation.PopAsync(true)调用它,它将在弹出页面时执行动画。您可以尝试使用神奇库 用
async void LogOut_Tapped(object sender, EventArgs e)
{
await Navigation.PopAsync();
}
请帮帮我。PopAsync有一个接受布尔值以指示是否应设置动画的。如果您使用
Navigation.PopAsync(true)
调用它,它将在弹出页面时执行动画。您可以尝试使用神奇库
用法
public class App : Application
{
public App()
{
MainPage = new AnimationNavigationPage(new YourHomePage());
}
}
创建AnimationPage而不是ContentPage,并在xaml中创建FadePageAnimation或PushPageAnimation或FlipPageAnimation等实例,或从ViewModel绑定
<?xml version="1.0" encoding="UTF-8"?>
<controls:AnimationPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:FormsControls.Base;assembly=FormsControls.Base"
x:Class="Sample.FadeAnimationPage"
Title="Fade Animation">
<controls:AnimationPage.PageAnimation>
<controls:FadePageAnimation />
</controls:AnimationPage.PageAnimation>
</controls:AnimationPage>
当页面弹出时,我想要从右向左的动画。我在ios中制作了导航页面的渲染器,其中我覆盖了UIViewController的PopViewController方法。不使用组件时不调用PopViewControllerany解决方案。
public partial class FirstPage : ContentPage, IAnimationPage
{
public FirstPage()
{
InitializeComponent();
}
public IPageAnimation PageAnimation { get; } = new FlipPageAnimation { Duration = 650, Subtype = AnimationSubtype.FromLeft };
}