c# - 无法创建 xamarin.ios native 控件包装器

标签 c# ios xamarin.ios xamarin wrapper

我正在尝试创建此 iOS native 控件的 xamarin 包装器https://github.com/ECSlidingViewController/ECSlidingViewController

我遵循那里的说明http://docs.xamarin.com/guides/ios/advanced_topics/binding_objective-c/binding_walkthrough/
我创建了 iOS 绑定(bind)项目,但无法构建项目。有错误:

Error BI1018: btouch: No [Export] attribute on property ECSliding.ECSlidingViewController.IsAnimated (BI1018) (ECSlidingBinding)

Error BI1018: btouch: No [Export] attribute on property ECSliding.ECSlidingViewController.ContainerView (BI1018) (ECSlidingBinding)

ApiDefinitions.cs(摘录)

[BaseType (typeof (UIViewController))]
public partial interface ECSlidingViewController : IUIViewControllerContextTransitioning, IUIViewControllerTransitionCoordinator, IUIViewControllerTransitionCoordinatorContext {

    [Static, Export ("slidingWithTopViewController:")]
    ECSlidingViewController SlidingWithTopViewController (UIViewController topViewController);

    [Export ("initWithTopViewController:")]
    IntPtr Constructor (UIViewController topViewController);

    [Export ("topViewController", ArgumentSemantic.Retain)]
    UIViewController TopViewController { get; set; }

    [Export ("underLeftViewController", ArgumentSemantic.Retain)]
    UIViewController UnderLeftViewController { get; set; }

    [Export ("underRightViewController", ArgumentSemantic.Retain)]
    UIViewController UnderRightViewController { get; set; }

    [Export ("anchorLeftPeekAmount")]
    float AnchorLeftPeekAmount { get; set; }

    [Export ("anchorLeftRevealAmount")]
    float AnchorLeftRevealAmount { get; set; }

    [Export ("anchorRightPeekAmount")]
    float AnchorRightPeekAmount { get; set; }

    [Export ("anchorRightRevealAmount")]
    float AnchorRightRevealAmount { get; set; }

    [Export ("anchorTopViewToRightAnimated:")]
    void AnchorTopViewToRightAnimated (bool animated);

    [Export ("anchorTopViewToRightAnimated:onComplete:")]
    void AnchorTopViewToRightAnimated (bool animated, Delegate complete);

    [Export ("anchorTopViewToLeftAnimated:")]
    void AnchorTopViewToLeftAnimated (bool animated);

    [Export ("anchorTopViewToLeftAnimated:onComplete:")]
    void AnchorTopViewToLeftAnimated (bool animated, Delegate complete);

    [Export ("resetTopViewAnimated:")]
    void ResetTopViewAnimated (bool animated);

    [Export ("resetTopViewAnimated:onComplete:")]
    void ResetTopViewAnimated (bool animated, Delegate complete);

    [Export ("topViewControllerStoryboardId", ArgumentSemantic.Retain)]
    string TopViewControllerStoryboardId { get; set; }

    [Export ("underLeftViewControllerStoryboardId", ArgumentSemantic.Retain)]
    string UnderLeftViewControllerStoryboardId { get; set; }

    [Export ("underRightViewControllerStoryboardId", ArgumentSemantic.Retain)]
    string UnderRightViewControllerStoryboardId { get; set; }

    [Export ("delegate", ArgumentSemantic.Assign)]
    ECSlidingViewControllerDelegate Delegate { get; set; }

    [Export ("topViewAnchoredGesture")]
    ECSlidingViewControllerAnchoredGesture TopViewAnchoredGesture { get; set; }

    [Export ("currentTopViewPosition")]
    ECSlidingViewControllerTopViewPosition CurrentTopViewPosition { get; }

    [Export ("panGesture", ArgumentSemantic.Retain)]
    UIPanGestureRecognizer PanGesture { get; }

    [Export ("resetTapGesture", ArgumentSemantic.Retain)]
    UITapGestureRecognizer ResetTapGesture { get; }

    [Export ("customAnchoredGestures", ArgumentSemantic.Retain)]//, Verify ("NSArray may be reliably typed, check the documentation", "/Users/admin/Desktop/all/ECSlidingViewController1/ECSlidingViewController/ECSlidingViewController.h", Line = 294)]
    NSObject [] CustomAnchoredGestures { get; set; }

    [Export ("isAnimated")]
    bool IsAnimated {get; set;}

    [Export ("containerView")]
    UIView ContainerView {get; set;}
}

您能解释一下可能出现的问题吗?

您可以下载完整项目here .

最佳答案

问题是 series of bugs在 Xamarin.iOS 中,当从绑定(bind)项目中的协议(protocol)继承时,如下所示:

public partial interface ECSlidingViewController :
    IUIViewControllerContextTransitioning,
    IUIViewControllerTransitionCoordinator, 
    IUIViewControllerTransitionCoordinatorContext {

在解决此问题之前,请尝试删除所有这些接口(interface):

public partial interface ECSlidingViewController {

关于c# - 无法创建 xamarin.ios native 控件包装器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20696157/

相关文章:

ios - Swift 中的折线叠加

objective-c - 游戏套件(GKSession): Is there a priority order when GKSession decides to use Wifi or Bluetooth (if both are available)

c# - iOS 中的重复性后台任务

ios - 根据 Swift Xcode 中的变量将 UI 图像更改为特定图像

xamarin.ios - mvvmcross 与 Xamarin.Forms

c# - 添加类库程序集后出现 FileNotFoundException

c# - 如何从 MS-Word 文档文件中提取文本数据

c# - Queue<T> 实际实现了什么

c# - 为什么这个泛型方法要求 T 有一个公共(public)的、无参数的构造函数?

objective-c - 尽量减少重复代码?