我假设应该将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中构建我的绑定项目,但我在btouch中得到了以下错误。我使用命令"/Developer/MonoTouch/usr/bin/btouch MyBindingLib.cs -s:extras.cs“
MyBindingLib.cs(12,19): error CS0260: Missing partial modifier on declaration
of type `mybindingtest.ReaderDocument'. Another partial declaration of this type
exists
extras.cs(6,30): (Location of the symbol related to previous error)
extras.cs(6,30): error CS0261: Partial declarations of `mybindingtest.ReaderDocument'
must be all classes, all structs or all interfaces发布于 2013-03-03 23:17:19
btouch不知道存在的所有类型,只知道基本类型和您定义的类型。在这种情况下,您可以通过两个步骤来绑定它。
首先将CGPDFDocumentRef绑定为IntPtr,并将其修饰为[Internal]。
[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) { }
}发布于 2013-03-05 00:11:19
在核心图形研讨会上有一个使用CGPDFDocument的例子:
http://www.youtube.com/watch?v=MNxVMYKaZP0
相关代码如下:
https://stackoverflow.com/questions/15184829
复制相似问题