I want to open a document on my iphone app written in monotouch - i.e. launch a PDF file in the default PDF viewer.
I think I should be using UIDocumentInterationController?
Anyone have any Ideas on this..
I have put together the following on a viewcontroller ( with a toolbar)
but it doesnt work :-( It does nothing!!
string s = string.Format("{0}",strFilePath); NSUrl ns = NSUrl.FromFilename (s); UIDocumentInteractionController PreviewController = UIDocumentInteractionController.FromUrl(ns); PreviewController.Delegate = new UIDocumentInteractionControllerDelegateClass(); PreviewController.PresentOpenInMenu(btnOpen,true);
public class UIDocumentInteractionControllerDelegateClass : UIDocumentInteractionControllerDelegate
{
public UIViewController FileViewController = new UIViewController();
public UIDocumentInteractionControllerDelegateClass ()
{
}
public override UIViewController ViewControllerForPreview (UIDocumentInteractionController controller)
{
return FileViewController;
}
public override UIView ViewForPreview (UIDocumentInteractionController controller)
{
return FileViewController.View;
}
}