【问题标题】:How can bind property block monotouch如何绑定属性块 monotouch
【发布时间】:2013-02-27 05:31:20
【问题描述】:

我正在学习如何将目标 c 绑定到 monotouch,但我遇到了块属性问题

@property (nonatomic, copy) void (^onLongPress)(UIView*, NSInteger);

我现在有这个

delegate void onLongPress (UIView view, int index);
[Export ("onLongPress")]
void onLongPress() {  set;  }

【问题讨论】:

    标签: binding xamarin.ios


    【解决方案1】:

    关于如何绑定块的文档在 http://docs.xamarin.com/guides/ios/advanced_topics/binding_objective-c_libraries at 3.10

    但是您的代码显示的是块属性,而不是获取属性的函数。

    在你的情况下,我会这样绑定它:

    //ApiDefinition.cs
    delegate void OnLongPress (UIView view, int index)
    
    [Export("onLongPress")]
    OnLongPress OnLongPress { set;}
    

    这可能会奏效,但由于我从未遇到过这种特殊情况,我对你的结果很感兴趣。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多