我想实现一个MonoTouch的为FastPDFKit结合。 我有与继承的构造麻烦。 我想结合来自fastPDFKit“ReaderViewController”。 ReaderViewController从MFDocumentViewController从UIViewController的继承继承。
我的C#
NSUrl fullURL = new NSUrl (fullPath);
FastPDFKitBinding.MFDocumentManager DocManager = new FastPDFKitBinding.MFDocumentManager (fullURL);
DocManager.EmptyCache ();
//line where the errors occur
FastPDFKitBinding.ReaderViewController pdfView = new FastPDFKitBinding.ReaderViewController (DocManager);
pdfView.DocumentID = PageID.ToString ();
Source.PView.PresentViewController(pdfView, true, null);
此代码不建立,给我两个错误,当我使新ReaderViewController:
Error CS1502: The best overloaded method match for `FastPDFKitBinding.ReaderViewController.ReaderViewController(MonoTouch.Foundation.NSCoder)' has some invalid arguments (CS1502) (iOSFlightOpsMobile)
Error CS1503: Argument `#1' cannot convert `FastPDFKitBinding.MFDocumentManager' expression to type `MonoTouch.Foundation.NSCoder' (CS1503) (iOSFlightOpsMobile)
我结合相关部分
namespace FastPDFKitBinding
{
[BaseType (typeof (UIAlertViewDelegate))]
interface MFDocumentManager {
[Export ("initWithFileUrl:")]
IntPtr Constructor (NSUrl URL);
[Export ("emptyCache")]
void EmptyCache ();
[Export ("release")]
void Release ();
}
[BaseType (typeof (UIViewController))]
interface MFDocumentViewController {
[Export ("initWithDocumentManager:")]
IntPtr Constructor (MFDocumentManager docManager);
[Export ("documentId")]
string DocumentID { get; set; }
[Export ("documentDelegate")]
NSObject DocumentDelegate { set; }
}
[BaseType (typeof (MFDocumentViewController))]
interface ReaderViewController {
}
}
现在,我可以采取从MFDocumentViewController结合出口和把它们放在我的ReaderViewController接口摆脱错误的。
[BaseType (typeof (UIViewController))]
interface MFDocumentViewController {
}
[BaseType (typeof (MFDocumentViewController))]
interface ReaderViewController {
[Export ("initWithDocumentManager:")]
IntPtr Constructor (MFDocumentManager docManager);
[Export ("documentId")]
string DocumentID { get; set; }
[Export ("documentDelegate")]
NSObject DocumentDelegate { set; }
}
但我不希望这样做,因为这些构造函数/方法MFDocumentViewController定义。 我该如何绑定正确使用这些继承的方法/构造函数。