Home > Mobile >  Xamarin iOS disable navigation swipe effect
Xamarin iOS disable navigation swipe effect

Time:09-28

I'm new to mobile development and I wanted to ask about a way to switch pages without the navigation swipe effect, just press the button and the required page will appear instead of the old one. I thought about the TabbedPage but it won't work with my UI. Thanks

CodePudding user response:

We can use interactivePopGestureRecognizer to disable navigation swipe effect .

Just create a renderer for Page , and do it in ViewWillLayoutSubviews method .

[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;
            }
        }
    }
}

Refer to Disable swipe back gesture in Swift.

CodePudding user response:

when you push the screen, just write to animate argument false

await Navigation.PushAsync (newPage, false);
  • Related