Monotouch Events

I am trying to run the following code with MonoTouch:

this.TouchesBegan += delegate { txtAmount.ResignFirstResponder(); }; 

When compiling, I get the following error:

 Cannot assign to `TouchesBegan' because it is a `method group' 

The API seems to support this: http://docs.xamarin.com/ios/advanced_topics/api_design

Any ideas?

+4
source share
1 answer

I assume that you are using UIGestureRecognizer correctly?

If so, `TouchesBegan 'is not an event method , so you cannot assign a delegate to it.

  public virtual void TouchesBegan (NSSet touches, UIEvent evt) 

You can watch:

  public UITouchEventArgs ShouldReceiveTouch; public UIGesturesProbe ShouldRecognizeSimultaneously; public UIGestureProbe ShouldBegin; 

and Touches_GestureRecognizers .

+3
source

Source: https://habr.com/ru/post/1379888/


All Articles