Forum Xamarin Xamarin.iOS

Tap Gesture Recognizer on a UILabel

wallymwallym USInsider, Beta ✭✭✭

I'm working up an example using the UITapGestureRecognizer on a label. I would think that this would work. Unfortunately, my TapCarrierLabel method is never being called. Any ideas? Source code below. is there something about the scrollview potentially grabbing the gesture recognizer? (Yeah, I am still pretty Hungarian after all these years.)

public override void ViewDidLoad ()
        base.ViewDidLoad ();
    // Perform any additional setup after loading the view, typically from a nib.
    uisv = new UIScrollView ();
        uisv.Frame = this.View.Bounds;
        var halfScreenDisplay = this.View.Bounds.Width / 2;
    labelCarrier = new UILabel ();
        labelCarrier.Frame = new RectangleF(startingPointX, startingPointY, halfScreenDisplay - deltaX, standardControlHeight);
        labelCarrier.Text = "Carrier";
        labelCarrierTitle = new UILabel();
        labelCarrierTitle.Frame = new RectangleF(startingPointX, labelCarrier.Frame.Bottom + deltaY, halfScreenDisplay - deltaX, standardControlHeight);
        labelCarrierTitle.Text = "Select a Carrier";
        uitgr = new UITapGestureRecognizer(TapCarrierLabel);
        uiasCarrier = new UIActionSheet();

    public void TapCarrierLabel(UITapGestureRecognizer uitgr)
        var uiav = new UIAlertView("Test", "Test", null, "Ok", null);


Sign In or Register to comment.