在我的应用程序中,我创建了呈现的自定义导航,重写了OnPushAsync和PopViewController并在iOS上运行。
public class NavRenderer : NavigationRenderer
{
protected override async Task<bool> OnPushAsync(Page page, bool animated)
{ ...
}
public override UIViewController PopViewController(bool animated)
{
....
return base.PopViewController(false);
}
尝试在Android上执行相同的操作(?),如何覆盖OnPushAsync和PopViewController?
Tx
答案 0 :(得分:1)
您可以在Android渲染器中override
使用这些方法来推送和弹出Pages
public class NavRenderer : NavigationRenderer
{
public NavRenderer(Context context) : base(context)
{
}
protected override Task<bool> OnPushAsync(Page view, bool animated)
{
return base.OnPushAsync(view, animated);
}
protected override Task<bool> OnPopViewAsync(Page page, bool animated)
{
return base.OnPopViewAsync(page, animated);
}
}
这些是iOS渲染器中用于推并弹出Controllers
public class NavRenderer : NavigationRenderer
{
public override void PushViewController(UIViewController viewController, bool animated)
{
base.PushViewController(viewController, animated);
}
public override UIViewController PopViewController(bool animated)
{
return base.PopViewController(animated);
}
}