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

TouchesBegan doesn't work in iOS

$
0
0

I'm trying to handle start of touch in iOS project using TouchesBegan event. I've done everything, that is described here . Gestures like pan, swipe, longpress and so on work fine and I'm trying to create custom recognizer to handle TouchesBegan. I've added class MyGestureRecognizer, and added it to FancyIosLabelRenderer like others. There is the code of class:

public class MyGestureRecognizer : UITapGestureRecognizer 
    {
        public MyGestureRecognizer(Action action) : base(action)
        {
        }
    public override void TouchesBegan (Foundation.NSSet touches, UIEvent evt)
    {
        Console.Write ("Began");
        base.TouchesBegan (touches, evt);
    }

    public override void TouchesEnded (Foundation.NSSet touches, UIEvent evt)
    {
        Console.Write ("End");
        base.TouchesEnded (touches, evt);
    }

    public override void TouchesCancelled (Foundation.NSSet touches, UIEvent evt)
    {
        Console.Write ("Cancel");
        base.TouchesCancelled (touches, evt);
    }
}`

So, when I tap my label, TouchesBegan and TouchesEnded fire (and then tap event fires). But really TouchesBegan fires only together with TouchesEnded and tap. Also, when I do "longpress", TouchesBegan fires at the end, together with LongPress. So it doesn't work actually. How can I handle this event correctly?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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