Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

18. iCloud Basics > Recipe: Subclassing UIDocument

Recipe: Subclassing UIDocument

At a minimum, each document instance inherits two core responsibilities: to produce its actual document data on demand and to update itself to new data in response to iCloud refreshes. When you subclass UIDocument, you must implement two methods. Recipe 18-2 presents the barest-bones document subclass that you might create:

• The loadFromContents:error: method brings new content to the class, allowing it to update its internal data. When it receives its new data, it pings an informal delegate to let it know that it’s a good time to reload the image.

• The contentsForType :error: method gets called whenever the user saves data locally. Here, you produce a data representation of your document that can be stored to the cloud, allowing you to publish that data ubiquitously.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial