Book description
Overcome the vexing issues you’re likely to face when creating apps for the iPhone, iPad, or iPod touch. With new and thoroughly revised recipes in this updated cookbook, you’ll quickly learn the steps necessary to work with the iOS 7 SDK, including solutions for bringing real-world physics and movement to your apps with UIKit Dynamics APIs.
You’ll learn hundreds of techniques for storing and protecting data, sending and receiving notifications, enhancing and animating graphics, managing files and folders, and many other options. Each recipe includes sample code you can use right away.
- Create vibrant and lifelike user interfaces with UIKit Dynamics
- Use the Keychain to protect your app’s data
- Develop location-aware and multitasking-aware apps
- Work with iOS 7’s audio and video APIs
- Use Event Kit UI to manage calendars, dates, and events
- Take advantage of the accelerometer and the gyroscope
- Integrate iCloud into your apps
- Define the layout of UI elements with Auto Layout
- Get working examples for implementing gesture recognizers
- Retrieve and manipulate contacts and groups from the Address Book
- Determine a camera’s availability and access the Photo Library
Publisher resources
Table of contents
- iOS 7 Programming Cookbook
- Preface
-
1. Implementing Controllers and Views
-
1.0. Introduction
- Creating and Running Our First iOS App
- Defining and Understanding Variables
- Creating and Taking Advantage of Classes
- Adding Functionality to Classes with Methods
- Conforming to Requirements of Other Classes with Protocols
- Storing Items in and Retrieving Them from Collections
- Adding Object Subscripting Support to Your Classes
- 1.1. Displaying Alerts with UIAlertView
- 1.2. Creating and Using Switches with UISwitch
- 1.3. Customizing the UISwitch
- 1.4. Picking Values with the UIPickerView
- 1.5. Picking the Date and Time with UIDatePicker
- 1.6. Implementing Range Pickers with UISlider
- 1.7. Customizing the UISlider
- 1.8. Grouping Compact Options with UISegmentedControl
- 1.9. Presenting and Managing Views with UIViewController
- 1.10. Presenting Sharing Options with UIActivityViewController
- 1.11. Presenting Custom Sharing Options with UIActivityViewController
- 1.12. Implementing Navigation with UINavigationController
- 1.13. Manipulating a Navigation Controller’s Array of View Controllers
- 1.14. Displaying an Image on a Navigation Bar
- 1.15. Adding Buttons to Navigation Bars Using UIBarButtonItem
- 1.16. Presenting Multiple View Controllers with UITabBarController
- 1.17. Displaying Static Text with UILabel
- 1.18. Customizing the UILabel
- 1.19. Accepting User Text Input with UITextField
- 1.20. Displaying Long Lines of Text with UITextView
- 1.21. Adding Buttons to the User Interface with UIButton
- 1.22. Displaying Images with UIImageView
- 1.23. Creating Scrollable Content with UIScrollView
- 1.24. Loading Web Pages with UIWebView
- 1.25. Displaying Progress with UIProgressView
- 1.26. Constructing and Displaying Styled Texts
- 1.27. Presenting Master-Detail Views with UISplitViewController
- 1.28. Enabling Paging with UIPageViewController
- 1.29. Displaying Popovers with UIPopoverController
-
1.0. Introduction
-
2. Creating Dynamic and Interactive User Interfaces
- 2.0. Introduction
- 2.1. Adding Gravity to Your UI Components
- 2.2. Detecting and Reacting to Collisions Between UI Components
- 2.3. Animating Your UI Components with a Push
- 2.4. Attaching Multiple Dynamic Items to Each Other
- 2.5. Adding a Dynamic Snap Effect to Your UI Components
- 2.6. Assigning Characteristics to Your Dynamic Effects
- 3. Auto Layout and the Visual Format Language
-
4. Constructing and Using Table Views
- 4.0. Introduction
- 4.1. Populating a Table View with Data
- 4.2. Using Different Types of Accessories in a Table View Cell
- 4.3. Creating Custom Table View Cell Accessories
- 4.4. Enabling Swipe Deletion of Table View Cells
- 4.5. Constructing Headers and Footers in Table Views
- 4.6. Displaying Context Menus on Table View Cells
- 4.7. Moving Cells and Sections in Table Views
- 4.8. Deleting Cells and Sections from Table Views
- 4.9. Utilizing the UITableViewController for Easy Creation of Table Views
- 4.10. Displaying a Refresh Control for Table Views
-
5. Building Complex Layouts with Collection Views
- 5.0. Introduction
- 5.1. Constructing Collection Views
- 5.2. Assigning a Data Source to a Collection View
- 5.3. Providing a Flow Layout to a Collection View
- 5.4. Providing Basic Content to a Collection View
- 5.5. Feeding Custom Cells to Collection Views Using .xib Files
- 5.6. Handling Events in Collection Views
- 5.7. Providing a Header and a Footer in a Flow Layout
- 5.8. Adding Custom Interactions to Collection Views
- 5.9. Providing Contextual Menus on Collection View Cells
- 6. Storyboards
-
7. Concurrency
- 7.0. Introduction
- 7.1. Constructing Block Objects
- 7.2. Accessing Variables in Block Objects
- 7.3. Invoking Block Objects
- 7.4. Performing UI-Related Tasks with GCD
- 7.5. Executing Non-UI Related Tasks Synchronously with GCD
- 7.6. Executing Non-UI Related Tasks Asynchronously with GCD
- 7.7. Performing Tasks after a Delay with GCD
- 7.8. Performing a Task Only Once with GCD
- 7.9. Grouping Tasks Together with GCD
- 7.10. Constructing Your Own Dispatch Queues with GCD
- 7.11. Running Tasks Synchronously with Operations
- 7.12. Running Tasks Asynchronously with Operations
- 7.13. Creating Dependency Between Operations
- 7.14. Creating Timers
- 7.15. Creating Concurrency with Threads
- 7.16. Invoking Background Methods
- 7.17. Exiting Threads and Timers
-
8. Security
- 8.0. Introduction
- 8.1. Enabling Security and Protection for Your Apps
- 8.2. Storing Values in the Keychain
- 8.3. Finding Values in the Keychain
- 8.4. Updating Existing Values in the Keychain
- 8.5. Deleting Exiting Values in the Keychain
- 8.6. Sharing Keychain Data Between Multiple Apps
- 8.7. Writing to and Reading Keychain Data from iCloud
- 8.8. Storing Files Securely in the App Sandbox
- 8.9. Securing Your User Interface
-
9. Core Location and Maps
- 9.0. Introduction
- 9.1. Creating a Map View
- 9.2. Handling the Events of a Map View
- 9.3. Pinpointing the Location of a Device
- 9.4. Displaying Pins on a Map View
- 9.5. Displaying Pins with Different Colors on a Map View
- 9.6. Displaying Custom Pins on a Map View
- 9.7. Converting Meaningful Addresses to Longitude and Latitude
- 9.8. Converting Longitude and Latitude to a Meaningful Address
- 9.9. Searching on a Map View
- 9.10. Displaying Directions on the Map
- 10. Implementing Gesture Recognizers
-
11. Networking, JSON, XML, and Sharing
- 11.0. Introduction
- 11.1. Downloading Asynchronously with NSURLConnection
- 11.2. Handling Timeouts in Asynchronous Connections
- 11.3. Downloading Synchronously with NSURLConnection
- 11.4. Modifying a URL Request with NSMutableURLRequest
- 11.5. Sending HTTP GET Requests with NSURLConnection
- 11.6. Sending HTTP POST Requests with NSURLConnection
- 11.7. Sending HTTP DELETE Requests with NSURLConnection
- 11.8. Sending HTTP PUT Requests with NSURLConnection
- 11.9. Serializing Arrays and Dictionaries into JSON
- 11.10. Deserializing JSON into Arrays and Dictionaries
- 11.11. Integrating Social Sharing into Your Apps
- 11.12. Parsing XML with NSXMLParser
-
12. Audio and Video
- 12.0. Introduction
- 12.1. Playing Audio Files
- 12.2. Handling Interruptions While Playing Audio
- 12.3. Recording Audio
- 12.4. Handling Interruptions While Recording Audio
- 12.5. Playing Audio over Other Active Sounds
- 12.6. Playing Video Files
- 12.7. Capturing Thumbnails from Video Files
- 12.8. Accessing the Music Library
-
13. Address Book
- 13.0. Introduction
- 13.1. Requesting Access to the Address Book
- 13.2. Retrieving a Reference to an Address Book
- 13.3. Retrieving All the People in the Address Book
- 13.4. Retrieving Properties of Address Book Entries
- 13.5. Inserting a Person Entry into the Address Book
- 13.6. Inserting a Group Entry into the Address Book
- 13.7. Adding Persons to Groups
- 13.8. Searching the Address Book
- 13.9. Retrieving and Setting a Person’s Address Book Image
- 14. Files and Folder Management
-
15. Camera and the Photo Library
- 15.0. Introduction
- 15.1. Detecting and Probing the Camera
- 15.2. Taking Photos with the Camera
- 15.3. Taking Videos with the Camera
- 15.4. Storing Photos in the Photo Library
- 15.5. Storing Videos in the Photo Library
- 15.6. Retrieving Photos and Videos from the Photo Library
- 15.7. Retrieving Assets from the Assets Library
- 15.8. Editing Videos on an iOS Device
-
16. Multitasking
- 16.0. Introduction
- 16.1. Detecting the Availability of Multitasking
- 16.2. Completing a Long-Running Task in the Background
- 16.3. Adding Background Fetch Capabilities to Your Apps
- 16.4. Playing Audio in the Background
- 16.5. Handling Location Changes in the Background
- 16.6. Saving and Loading the State of Multitasking Apps
- 16.7. Handling Network Connections in the Background
- 16.8. Opting Out of Multitasking
-
17. Notifications
- 17.0. Introduction
- 17.1. Sending Notifications
- 17.2. Listening for and Reacting to Notifications
- 17.3. Listening and Reacting to Keyboard Notifications
- 17.4. Scheduling Local Notifications
- 17.5. Listening for and Reacting to Local Notifications
- 17.6. Handling Local System Notifications
- 17.7. Setting Up Your App for Push Notifications
- 17.8. Delivering Push Notifications to Your App
- 17.9. Reacting to Push Notifications
-
18. Core Data
- 18.0. Introduction
- 18.1. Creating a Core Data Model with Xcode
- 18.2. Generating Class Files for Core Data Entities
- 18.3. Creating and Saving Data Using Core Data
- 18.4. Reading Data from Core Data
- 18.5. Deleting Data from Core Data
- 18.6. Sorting Data in Core Data
- 18.7. Boosting Data Access in Table Views
- 18.8. Implementing Relationships in Core Data
- 18.9. Fetching Data in the Background
- 18.10. Using Custom Data Types in Your Core Data Model
-
19. Dates, Calendars, and Events
- 19.0. Introduction
- 19.1. Requesting Permission to Access Calendars
- 19.2. Retrieving Calendar Groups on an iOS Device
- 19.3. Adding Events to Calendars
- 19.4. Accessing the Contents of Calendars
- 19.5. Removing Events from Calendars
- 19.6. Adding Recurring Events to Calendars
- 19.7. Retrieving the Attendees of an Event
- 19.8. Adding Alarms to Calendars
- 19.9. Handling Event Changed Notifications
- 19.10. Presenting Event View Controllers
- 19.11. Presenting Event Edit View Controllers
-
20. Graphics and Animations
- 20.0. Introduction
- 20.1. Enumerating and Loading Fonts
- 20.2. Drawing Text
- 20.3. Constructing, Setting, and Using Colors
- 20.4. Drawing Images
- 20.5. Constructing Resizable Images
- 20.6. Drawing Lines
- 20.7. Constructing Paths
- 20.8. Drawing Rectangles
- 20.9. Adding Shadows to Shapes
- 20.10. Drawing Gradients
- 20.11. Moving Shapes Drawn on Graphic Contexts
- 20.12. Scaling Shapes Drawn on Graphic Contexts
- 20.13. Rotating Shapes Drawn on Graphic Contexts
- 20.14. Animating and Moving Views
- 20.15. Animating and Scaling Views
- 20.16. Animating and Rotating Views
- 20.17. Capturing a Screenshot of Your View into an Image
- 21. Core Motion
-
22. iCloud
- 22.0. Introduction
- 22.1. Setting Up Your App for iCloud
- 22.2. Storing and Synchronizing Dictionaries in iCloud
- 22.3. Creating and Managing Folders for Apps in iCloud
- 22.4. Searching for Files and Folders in iCloud
- 22.5. Storing User Documents in iCloud
- 22.6. Managing the State of Documents in iCloud
-
23. Pass Kit
- 23.0. Introduction
- 23.1. Creating Pass Kit Certificates
- 23.2. Creating Pass Files
- 23.3. Providing Icons and Images for Passes
- 23.4. Preparing Your Passes for Digital Signature
- 23.5. Signing Passes Digitally
- 23.6. Distributing Passes Using Email
- 23.7. Distributing Passes Using Web Services
- 23.8. Enabling Your iOS Apps to Access Passes on iOS Devices
- 23.9. Interacting with Passbook Programmatically
- Index
- About the Author
- Colophon
- Copyright
Product information
- Title: iOS 7 Programming Cookbook
- Author(s):
- Release date: October 2013
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781449372422
You might also like
book
iOS 5 Programming Cookbook
Now you can overcome the vexing, real-life issues you confront when creating apps for the iPhone, …
book
iOS Programming Cookbook
Over 50 exciting and powerful recipes to help you unearth the promise of iOS programming About …
book
iOS 4 Programming Cookbook
You can build a variety of amazing apps on the iOS platform—and every one of them …
book
iOS 10 Swift Programming Cookbook
Ready to build truly stunning apps for iPhone, iPad, and Apple Watch? This cookbook—written exclusively in …