Xamarin.ios 如何绑定CGPDFDocumentRef?

Xamarin.ios 如何绑定CGPDFDocumentRef?,xamarin.ios,Xamarin.ios,我假设CGPDFDocumentRef应该绑定到CGPDFDocument 我正在尝试下面的方法 //- (id)initWithPDFDocument:(CGPDFDocumentRef)_document filepath:(NSString *)fullFilePath; [Export("initWithPDFDocument:filepath:")] IntPtr Constructor (CGPDFDocument document, string path); 我

我假设CGPDFDocumentRef应该绑定到CGPDFDocument

我正在尝试下面的方法

    //- (id)initWithPDFDocument:(CGPDFDocumentRef)_document filepath:(NSString *)fullFilePath;
    [Export("initWithPDFDocument:filepath:")]
IntPtr Constructor (CGPDFDocument document, string path);
我还包括:

using MonoTouch.CoreGraphics;
当我尝试编译绑定项目时,出现以下错误:

: error BI1002: btouch: Unknown kind MonoTouch.CoreGraphics.CGPDFDocument document in method 'pdftest.ReaderDocument.Constructor'
编辑:

从poupou输入后,我有以下内容:

    [BaseType (typeof (NSObject))]
    partial interface ReaderDocument {

    [Export("initWithPDFDocument:filepath:")] 
    [Internal] IntPtr Constructor (IntPtr document, string path);
在extras.cs中:

    public partial class ReaderDocument {
        public ReaderDocument (CGPDFDocument doc, string path) : this (doc.Handle, path) { }
    }
我可以在MonoDevelop中构建我的bindingproject,但在btouch中出现以下错误。 我正在使用命令“/Developer/MonoTouch/usr/bin/btouch MyBindingLib.cs-s:extras.cs”


b触摸
不知道存在的所有类型,只知道基本类型和您定义的类型。在这种情况下,您可以分两步绑定它

首先将
CGPDFDocumentRef
绑定为
IntPtr
,并将其装饰为
[内部]

[Export("initWithPDFDocument:filepath:")]
[Internal]
IntPtr Constructor (IntPtr document, string path);
接下来在
Extra.cs
文件中添加一个自定义构造函数

partial public class YourType {
   public YourType (CGPDFDocument doc, string path) : this (doc.Handle, path) { }
}

b触摸
不知道存在的所有类型,只知道基本类型和您定义的类型。在这种情况下,您可以分两步绑定它

首先将
CGPDFDocumentRef
绑定为
IntPtr
,并将其装饰为
[内部]

[Export("initWithPDFDocument:filepath:")]
[Internal]
IntPtr Constructor (IntPtr document, string path);
接下来在
Extra.cs
文件中添加一个自定义构造函数

partial public class YourType {
   public YourType (CGPDFDocument doc, string path) : this (doc.Handle, path) { }
}

在Core Graphics研讨会上有一个使用CGPDFDocument的示例:

相关代码如下:


在Core Graphics研讨会上有一个使用CGPDF文档的示例:

相关代码如下:


谢谢你,波波。由于这些更改,我无法构建我的DLL文件(使用btouch)。我已经用更改编辑了我的起始帖子。我在GoogleMaps绑定的extras.cs文件中看到,它们也提到了接口的部分类。所以我不知道为什么它在我这边不起作用(可能是因为我定义了一个构造函数),谢谢你。由于这些更改,我无法构建我的DLL文件(使用btouch)。我已经用更改编辑了我的起始帖子。我在GoogleMaps绑定的extras.cs文件中看到,它们也提到了接口的部分类。所以不确定为什么它在我这边不起作用(可能是因为我定义了一个构造函数),你能发布你的
btouch
命令和你正在使用的参数吗?还有为什么不使用XamarinStudio的iOS绑定项目呢?这将大大简化您的绑定体验:)顺便说一句,下面的答案是正确的,我自己已经实现了好几次,不管它是否是一个构造函数,你可以检查这个项目,包含了大量的例子是btouch无法自动处理谢谢。我使用的是iOS绑定项目,但我不知道这会自动在特定子文件夹中创建DLL文件:-)你能发布你的
btouch
命令和你正在使用的参数吗?还有为什么不使用XamarinStudio的iOS绑定项目?这将大大简化您的绑定体验:)顺便说一句,下面的答案是正确的,我自己已经实现了好几次,不管它是否是一个构造函数,你可以检查这个项目,包含了大量的例子是btouch无法自动处理谢谢。我正在使用iOS绑定项目,但我不知道这会自动在特定子文件夹中创建DLL文件:-)这个问题是关于将自定义obj-c类绑定到c类。这个问题是关于将自定义obj-c类绑定到c类。