我正在尝试使用MonoTouch运行以下代码:
this.TouchesBegan += delegate { txtAmount.ResignFirstResponder(); };
编译时出现以下错误:
Cannot assign to `TouchesBegan' because it is a `method group'
API似乎支持这一点:http://docs.xamarin.com/ios/advanced_topics/api_design
有什么想法吗?
答案 0 :(得分:3)
我猜你正在使用UIGestureRecognizer
吗?
如果是,则“TouchesBegan”是方法而不是事件,因此您无法为其分配代理。
public virtual void TouchesBegan (NSSet touches, UIEvent evt)
您可能需要查看:
public UITouchEventArgs ShouldReceiveTouch;
public UIGesturesProbe ShouldRecognizeSimultaneously;
public UIGestureProbe ShouldBegin;