【发布时间】:2011-11-07 00:46:44
【问题描述】:
我正在尝试使用 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
有什么想法吗?
【问题讨论】:
-
除了 poupou 的回答,如果你想使用 TouchesBegan 方法,你必须继承 UIView (或任何你想使用的类的 TouchesBegan 方法)并覆盖它。
-
原来 UIViewController 也暴露了相同的方法,所以我简单地覆盖了它。
标签: c# ios events xamarin.ios uigesturerecognizer