Monotouch绑定Objective c类扩展/类别

时间:2012-11-08 19:54:18

标签: objective-c xamarin.ios

我正在尝试将我的第一个第三方库绑定到我的monotouch项目。大多数绑定工作,但我遇到绑定Objective C Class Extensions的问题。我知道Binding Objective-C Types文档中的“绑定类扩展”部分,但不幸的是它没有帮助我。

这些是我试图绑定的2个扩展名:

// category on UIViewController to provide access to the viewDeckController in the 
// contained viewcontrollers, a la UINavigationController.
@interface UIViewController (UIViewDeckItem) 

@property(nonatomic,readonly,retain) IIViewDeckController *viewDeckController; 

@end

// category on WrappedController to provide access to the viewDeckController in the 
// contained viewcontrollers, a la UINavigationController.
@interface UIViewController (WrapControllerItem) 

@property(nonatomic,readonly,assign) WrapController *wrapController; 

@end

这就是我试图绑定它们的方式:

[BaseType (typeof(UIResponder))]
interface UIViewController
{
    [Export ("viewDeckController", ArgumentSemantic.Retain)]
    IIViewDeckController ViewDeckController { get; set; }

    [Export ("wrapController", ArgumentSemantic.Assign)]
    WrapController WrapController { get; set; }
}

然后当我尝试在我的应用程序中编译它时:

公共部分类AgendaView:UIViewController

我收到以下错误:

'UIViewController'是'MonoTouch.UIKit.UIViewController'和'ViewDeck.UIViewController'之间的模糊引用

我试图在网上搜索解决方案,但我找不到它,所以如果有人能帮助我,我会很高兴。

提前致谢

1 个答案:

答案 0 :(得分:0)

您必须指定命名空间。 要么明确:

public partial class AgendaView : MonoTouch.UIKit.UIViewController
public partial class AgendaView : MyBindingsNamespace.UIViewController

using

using MyBindingsNamespace;
public partial class AgendaView : UIViewController