O'Reilly logo

Beginning iOS 5 Application Development by Wei-Meng Lee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

IMPORTING AND EXPORTING FILES

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):

    image

    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> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required