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

Chapter 7. Working with Images > Finding and Loading Images

Finding and Loading Images

iOS images are generally stored in one of five places. These sources allow you to access image data and display that data in your programs. These sources include the photo album, the application bundle, the sandbox, iCloud, and the Internet:

  • Photo album— The iOS’s photo album contains a camera roll (for camera-ready units), a saved pictures roll, and photos synced from the user’s computer or transferred from another digital device using a camera connection kit. Users can request images from this album using the interactive dialog supplied by the UIImagePickerController class. The dialog lets users browse through stored photos and select the image they want to work with on an album-by-album basis.

  • Application bundle— Your application bundle may store images along with your application executable, Info.plist file, and other resources. You can read these bundle-based images using their local file paths and display them in your application.

  • Sandbox— Your application can also write image files into your sandbox and read them back as needed. The sandbox lets you store files to the Documents, Library, and tmp folders. Each of these folders is readable by your application, and you can create new images by supplying a file path. The top-level Documents directory can be populated by and accessed from iTunes. Users can add images as well as other files to this shared folder from their computer when the application sets the UIFileSharingEnabled key in the Info.plist file. Although other parts of iOS outside the sandbox are technically readable, Apple has made it clear that these areas are off limits for App Store applications.

    Note

    When you use the Document file sharing option, make sure you store any application-specific files that should not be shared directly with your users in your Library folder.


  • iCloud— Apple’s iCloud service allows you to store documents in a shared central location and access them from all your user’s computers and iOS devices. On iOS, you typically use the UIDocument class to load iCloud images into your apps.

  • Internet— Your application can download images from the Net using URL resources to point to web-based files. To make this work, iOS needs an active web connection, but once connected the data from a remote image is just as accessible as data stored locally.


  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint