Created
January 10, 2020 10:00
-
-
Save simonemarra/00b12c30dd948c08f5eb920dd7a33295 to your computer and use it in GitHub Desktop.
Xamarin Forms (iOS): disable swipe back on provided page via custom renderer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Xamarin.Forms; | |
[assembly: ExportRenderer(typeof(Appname.Views.DeviceInfoPage), typeof(Appname.iOS.Renderers.NoSwipeBackPageRenderer))] | |
namespace Appname.iOS.Renderers | |
{ | |
// Custom Rendered to disable the swipe back of provided page type (in this case DeviceInfoPage...) | |
// source: https://forums.xamarin.com/discussion/26966/how-to-disable-swipe-gesture-on-pushed-page | |
public class NoSwipeBackPageRenderer : PageRenderer | |
{ | |
public override void ViewDidAppear(bool animated) | |
{ | |
base.ViewDidAppear(animated); | |
var navctrl = this.ViewController.NavigationController; | |
navctrl.InteractivePopGestureRecognizer.Enabled = false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!