Chapter 13. Graphics and media

 

This chapter covers

  • Adding images and app icons to your app bundle
  • Drawing in your app and creating a reusable custom view
  • Taking or selecting photos from the photo library
  • Detecting barcodes
  • Playing sounds

In this chapter, we’ll look at making your apps more visual! Though you want your app to follow Apple standards for app consistency, you also want your app to stand out in the crowd. We’ll explore changing the look of your app, from adding images and app icons to custom drawing. We’ll also look at allowing the user to add their own images from the camera and photo library and even turn their device into a barcode scanner!

Along the way, you’ll encounter additional concepts:

  • Asset catalog and image sets
  • Core graphics
  • Core animation
  • UIImagePickerController
  • AVFoundation

13.1. Adding images to your app with an asset catalog

You’ve probably noticed the Assets.xcassets file in your Project Navigator. This is the default asset catalog for your app and a convenient place to store assets. Though it’s possible to drag images directly to your Project Navigator to include them in your project bundle, an asset catalog is generally preferable. Why?

13.2. Displaying a launch screen

13.3. Drawing with Core Graphics

13.4. Drawing with Core Animation

13.5. Using the camera

13.6. Playing sounds

13.7. Summary