我是移動開發的新手,我想詢問一種沒有導航滑動效果的頁面切換方法,只需按下按鈕,所需頁面就會出現,而不是舊頁面。我想過 TabbedPage 但它不適用于我的用戶界面。謝謝
uj5u.com熱心網友回復:
我們可以使用interactivePopGestureRecognizer來禁用導航滑動效果。
只需為 Page 創建一個渲染器,然后在ViewWillLayoutSubviewsmethod 中完成。
[assembly: ExportRenderer(typeof(Page), typeof(MyPageRenderer))]
namespace FormsApp.iOS
{
class MyPageRenderer : PageRenderer
{
public override void ViewWillLayoutSubviews()
{
base.ViewWillLayoutSubviews();
if (NavigationController != null)
{
NavigationController.InteractivePopGestureRecognizer.Enabled = false;
}
}
}
}
請參閱在 Swift 中禁用向后滑動手勢。
uj5u.com熱心網友回復:
當您按下螢屏時,只需寫入 animate 引數 false
await Navigation.PushAsync (newPage, false);
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/313981.html
標籤:C# xml 沙马林 xamarin.forms xamarin.ios
