One of the common tasks that iOS developers have to do is import and export documents from their iOS application. For example, suppose you are developing a document reader and you want to allow the user to import documents into your application so that they can be read offline. In addition, your reader might also support the exporting of documents so that other applications can make use of them. In this section, you will learn the different techniques you can employ to allow documents to be imported into or exported from your iOS application.

The following Try It Out creates the project that you will use to learn the various methods to import and export documents.

TRY IT OUT: Creating the Project

  1. Using Xcode, create a new Single View (iPhone) application and name it OfflineReader. You will also use the project name as the Class Prefix and ensure that you have the Use Automatic Reference Counting option unchecked.
  2. Select the OfflineReaderViewController.xib file to open it in Interface Builder and populate it with a Web View and Round Rect Button (see Figure 10-8):


    FIGURE 10-8

  3. In the Attributes Inspector window for the Web View, ensure that you check the Scales Page to Fit option.
  4. In the OfflineReaderViewController.xib file, add the following statements in bold:
    #import <UIKit/UIKit.h>
    @interface OfflineReaderViewController : UIViewController
    <UIDocumentInteractionControllerDelegate> ...

Get Beginning iOS 5 Application Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.