Search code examples
file-ioxamarin.iosuidocumentinteraction

Monotouch: UIDocumentInteractionController, view documents (pdf, word, excel and so on) How to?


I have a question for you and I don't know to resolve it. I'll try to explain this scenario.

1) My iPad app connects to a web server and can download documents. 2) Once downloaded, it can open the document.

My questions are:

first, is it possible to download a stream (or something else) in the ipad? Do I have to save it as a temporany file?

second, how can I use the UIDocumentInteractionController to open that downloaded file?

Thank you in advance. Regards.

EDIT:

How it is possible to change the title for buttons of the preview document? By default, there is a button whose title is "Done". Is it possible to change its title or replace it with another one?

The code I'm using is the following:

public class UIDocumentInteractionControllerDelegateClass: UIDocumentInteractionControllerDelegate

public UIViewController FileViewController;
 public UIDocumentInteractionControllerDelegateClass (UIViewController parent)
 {
   FileController = parent;
 }

 public override UIViewController ViewControllerForPreview (UIDocumentInteractionController controller)
 {
   return FileViewController;    
 }

 public override UIView ViewForPreview (UIDocumentInteractionController controller)
 {
  return FileViewController.View;
 }
}

Solution

  • Get ready for some reading. :)

    You can find the answer to the first question here. Answer to the second question here.