Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

No Swipe Back when hiding Navigation Bar

$
0
0

I created a custom navigationbar. Works fine, only on iOS swipe back does not work. I'm trying to fix this with a custom render based on this thread: http://stackoverflow.com/questions/24710258/no-swipe-back-when-hiding-navigation-bar-in-uinavigationcontroller

This is my custom render:

[assembly: ExportRendererAttribute(typeof(BasePage), typeof(BasePageRenderer))]

namespace myapp
{
public class BasePageRenderer: PageRenderer, IUIGestureRecognizerDelegate
{
[Export("gestureRecognizerShouldBegin:")]
public bool ShouldBegin(UIGestureRecognizer recognizer)
{
if (recognizer is UIScreenEdgePanGestureRecognizer && NavigationController.ViewControllers.Length == 1)
{
return false;
}
return true;
}

    public override void ViewDidLoad()
    {
        base.ViewDidLoad();
        NavigationController.InteractivePopGestureRecognizer.Delegate = this;

    }
}

}

Somehow it crashes on this line: NavigationController.InteractivePopGestureRecognizer.Delegate = this;

Did someone implement this and got it working? Thanks.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>