Forum Xamarin.iOS

Need to disable swipe gesture of Shell FlyLayout in Native iOS.

JoannaGJoannaG Member ✭✭

Im trying to disable swipe gesture of FlyLayout in iOS. Tried with below code but noot working in iPad and works fine in iPhone.

[assembly: ExportRenderer(typeof(AppShell), typeof(iOSShellRenderer))]
namespace TestMenuSwipe.iOS
{

                public class iOSShellRenderer : ShellRenderer
                {
                                IShellFlyoutRenderer flyoutRenderer;

                                protected override IShellFlyoutRenderer CreateFlyoutRenderer()
                                {
                                                flyoutRenderer = base.CreateFlyoutRenderer(); 
                                                return flyoutRenderer;
                                }

                                public override void ViewWillAppear(bool animated)
                                {
                                                base.ViewWillAppear(animated);
                                                var type = flyoutRenderer.GetType();
                                                var property = type.GetProperty("PanGestureRecognizer", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
                                                var value = property.GetValue(flyoutRenderer);

                                                UIPanGestureRecognizer recognizer = value as UIPanGestureRecognizer;
                                                recognizer.Enabled = false;


                                }
                }
}

Is there any other property instead "PanGestureRecognizer" in iPad? Any suggesstions?

Sign In or Register to comment.