I am trying to attach a UITapGestureRecognizer to the View of a UIAlertController but the recognize event is never firing.
I am coding this in Xamarin, but I feel like the issue applies to native code as well.
InvokeOnMainThread(() =>
var alert = new UIAlertController();
alert.Title = "My Title";
alert.Message = "My Message";
UITapGestureRecognizer tapGestureRecognizer = new
UITapGestureRecognizer((gesture) =>
{
//I never get here
});
alert.View.AddGestureRecognizer(tapGestureRecognizer);
alert.View.UserInteractionEnabled = true;
this.PresentViewController(alert, true, null);
});
Ideally, I would like to dismiss the alert when a user touches the popup, but I can't seem to detect the gesture.
I've tried adding the recognizer both, before, and after the alert is presented.