In this book, we will discuss frameworks and classes that are available in iOS 3 and iOS 4. In some recipes, you will find code that runs only on iOS 4 and later; in those recipes, I note that you will need the iOS 4 SDK or later to compile the example code.
Here is a concise breakdown of the material each chapter covers:
Explains how Objective-C classes are structured and how objects can be instantiated. The chapter talks about properties and delegates as well as memory management in Objective-C. Even if you are competent in Objective-C, I strongly suggest that you go through this chapter, even if you are skimming through it, to understand the basic material that is used in the rest of the chapters.
Describes various approaches to constructing your iOS application’s user interface by taking advantage of different tools the SDK provides. This chapter also introduces you to features that are only available on the iPad, such as the popover and split view controllers.
Shows how you can work with table views to create professional-looking iOS applications. Table views are very dynamic in nature, and as a result, programmers sometimes have difficulty understanding how they should work with them. By reading this chapter and having a look at and trying out the example code, you will gain the knowledge that is required to comfortably work with table views.
Demonstrates the process of storyboarding, the new way to define the connection between different screens in your app. The great thing about storyboarding is that you don’t have to know anything about iOS programming to get a simple app running. This helps product analysts, product owners, or designers who work independently of developers to gain knowledge of the UI components iOS offers, and to build more robust products. Programmers can also take advantage of storyboarding to easily create prototypes. Storyboarding is just fun, whether you do it on paper or using Xcode.
As humans, we can do many things simultaneously without thinking much about it. With advances in computer technology, mobile devices are also able to multitask, and provide programmers with tools and mechanisms that can accomplish more than one task at the same time. This is called concurrency. In this chapter, you will learn about Grand Central Dispatch, Apple’s preferred way of achieving concurrency in iOS. You will also learn about timers, threads, and operations.
Describes how you should use Map Kit and Core Location APIs to develop location-aware iOS applications. First you will learn about maps, and then you will learn how to detect a device’s location and tailor your maps with custom annotations. You will also learn about geocoding and reverse geocoding, as well as some of the methods of the Core Location framework, which are only available in the iOS 4 SDK and later.
Demonstrates how to use gesture recognizers, which enable your users to easily and intuitively manipulate the graphical interface of your iOS applications. In this chapter, you will learn how to use all available gesture recognizers in the iOS SDK, with working examples tested on iOS 5 on different devices such as the iPhone 3GS, iPhone 4, and iPad.
Demonstrates how to download data from a URL and parse XML files. You will learn about synchronous and asynchronous connections and their pros and cons. You will also learn about caching files in memory and on disk to avoid consuming the possibly limited bandwidth of an iOS device on which your application could be running.
Discusses the AV Foundation and Media Player frameworks that are available on the iOS SDK. You will learn how to play audio and video files and how to handle interruptions, such as a phone call, while the audio or video is being played on iOS 5. This chapter also explains how to record audio using an iOS device’s built-in microphone(s). At the end of the chapter, you will learn how to access the iPod Library and play its media content, all from inside your application.
Explains the Address Book framework and how to retrieve contacts, groups, and their information from the Address Book database on an iOS device. The Address Book framework is composed entirely of C APIs. Because of this, many Objective-C developers find it difficult to use this framework compared to frameworks that provide an Objective-C interface. After reading this chapter and trying the examples for yourself, you will feel much more confident using the Address Book framework.
Demonstrates how you can determine the availability of front- and back-facing cameras on an iOS device. Some of the recipes in this chapter are specific to iOS 4 and above. You will also learn how to access the Photo Library using the Assets Library framework which is available in iOS 4 and later. At the end of the chapter, you will learn about editing videos right on an iOS device using a built-in view controller.
Explains, with examples, how to create multitasking-aware applications that run beautifully on iOS 4 and above. You will learn about background processing, from playing audio and retrieving users’ locations in the background, to downloading content from a URL while your application is running in the background.
Describes how to maintain persistent storage for your iOS applications using Core Data. You will learn how to add to, delete from, and edit Core Data objects and how to boost access to data in a table view. In addition, you will learn how to manage relationships between Core Data objects.
Demonstrates the use of the Event Kit and Event Kit UI frameworks, which are available on iOS 4 and later, in order to manage calendars and events on an iOS device. You will see how to create, modify, save, and delete events. You will also learn, through examples, how to add alarms to calendar events and how to set up CalDAV calendars so that you can share a single calendar among multiple devices.
Introduces the Core Graphics framework. You will learn how to draw images and text on a graphics context, grab the contents of a graphics context and save it as an image, and much more.
Explains the Core Motion framework. Using Core Motion, you will access the accelerometer and the gyroscope on an iOS device. You will also learn how to detect shakes on a device. Of course, not all iOS devices are equipped with an accelerometer and a gyroscope, so you will also learn how to detect the availability of the required hardware.
Shows how to use the iCloud service, which ties devices together and allows them to share data to provide a seamless user experience as the user moves from one device to another.