简体   繁体   中英

Monotouch Events

I am trying to run the following code with MonoTouch:

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

When I compile 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?

I guess you're using UIGestureRecognizer right ?

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

    public virtual void TouchesBegan (NSSet touches, UIEvent evt)

You might want to look at:

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

and the Touches_GestureRecognizers sample.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM