You are previewing The Core iOS 6 Developer’s Cookbook, Fourth Edition.
O'Reilly logo
The Core iOS 6 Developer’s Cookbook, Fourth Edition

Book Description

The Core iOS 6 Developer’s Cookbook brings together reliable, proven solutions for the heart of day-to-day iOS 6 development. World-renowned iOS programming expert Erica Sadun covers all the classes you’ll need to create successful iOS 6 mobile apps with standard APIs and interface elements and take full advantage of iOS 6 graphics, touches, and views.

As in her previous bestselling iOS books, Sadun translates today’s development best practices into working code, distilling key concepts into concise recipes that are easy to understand and transfer into your own projects. This isn’t just cut-and-paste; using her examples, Sadun fully explains both the “how” and “why” of effective iOS 6 development.

All code has been fully revised and extensively tested to reflect the latest iOS 6 features and the newest iPhone, iPad, and iPod touch capabilities. Throughout, every chapter groups related tasks together, so you can jump straight to your solution, without having to identify the right class or framework first. Coverage includes

  • Supporting direct user input through multitouch and gestures, including custom gesture recognizers

  • Building, customizing, and using iOS 6 controls

  • Alerting users via popup dialogs, progress bars, local notifications, popovers, audio pings, and other techniques

  • Assembling views and animation, organizing view hierarchies, and understanding how views work together

  • Using iOS 6’s breakthrough autolayout constraints system to simplify support for multiple screen geometries controlling keyboards, making onscreen elements “text aware,” and efficiently scanning and formatting text

  • Using view controllers to organize your users’ workspaces

  • Managing photos, videos, email, text messages, and iOS 6-enhanced social media updates

  • Implementing VoiceOver accessibility to reach even more users

  • Organizing apps simply and intuitively with tables and adding flexibility with iOS 6’s brand new collection views

  • Getting started with Core Data managed data stores

  • Leveraging iOS 6’s powerful networking and web services support

  • For related content by author Erica Sadun, see iOS Auto Layout Demystified, and The Advanced iOS 6 Cookbook.

    Table of Contents

    1. Title Page
    2. Copyright Page
    3. Dedication Page
    4. Contents at a Glance
    5. Table of Contents
    6. Acknowledgments
    7. About the Author
    8. Preface
      1. What You’ll Need
      2. Your Roadmap to Mac/iOS Development
      3. How This Book Is Organized
      4. About the Sample Code
      5. Getting the Sample Code
      6. Contribute!
      7. Getting Git
      8. Getting GitHub
      9. Contacting the Author
      10. Endnotes
      11. Editor’s Note: We Want to Hear from You!
    9. 1. Gestures and Touches
      1. Touches
      2. Recipe: Adding a Simple Direct Manipulation Interface
      3. Recipe: Adding Pan Gesture Recognizers
      4. Recipe: Using Multiple Gesture Recognizers Simultaneously
      5. Recipe: Constraining Movement
      6. Recipe: Testing Touches
      7. Recipe: Testing Against a Bitmap
      8. Recipe: Drawing Touches Onscreen
      9. Recipe: Smoothing Drawings
      10. Recipe: Using Multi-Touch Interaction
      11. Recipe: Detecting Circles
      12. Recipe: Creating a Custom Gesture Recognizer
      13. Recipe: Dragging from a Scroll View
      14. Recipe: Live Touch Feedback
      15. Recipe: Adding Menus to Views
      16. Summary
    10. 2. Building and Using Controls
      1. The UIControl Class
      2. Buttons
      3. Buttons in Interface Builder
      4. Recipe: Building Buttons
      5. Recipe: Animating Button Responses
      6. Recipe: Adding a Slider with a Custom Thumb
      7. Appearance Proxies
      8. Recipe: Creating a Twice-Tappable Segmented Control
      9. Working with Switches and Steppers
      10. Recipe: Subclassing UIControl
      11. Recipe: Building a Star Slider
      12. Recipe: Building a Touch Wheel
      13. Recipe: Creating a Pull Control
      14. Recipe: Building a Custom Lock Control
      15. Adding a Page Indicator Control
      16. Recipe: Creating a Customizable Paged Scroller
      17. Building Toolbars
      18. Summary
    11. 3. Alerting the User
      1. Talking Directly to Your User Through Alerts
      2. “Please Wait”: Showing Progress to Your User
      3. Recipe: No-Button Alerts
      4. Recipe: Creating Modal Alerts with Run Loops
      5. Recipe: Using Variadic Arguments with Alert Views
      6. Presenting Lists of Options
      7. Recipe: Building Custom Overlays
      8. Recipe: Basic Popovers
      9. Recipe: Local Notifications
      10. Alert Indicators
      11. Recipe: Simple Audio Alerts
      12. Summary
    12. 4. Assembling Views and Animations
      1. View Hierarchies
      2. Recipe: Recovering a View Hierarchy Tree
      3. Recipe: Querying Subviews
      4. Managing Subviews
      5. Tagging and Retrieving Views
      6. Recipe: Naming Views by Object Association
      7. View Geometry
      8. Recipe: Working with View Frames
      9. Recipe: Retrieving Transform Information
      10. Display and Interaction Traits
      11. UIView Animations
      12. Recipe: Fading a View In and Out
      13. Recipe: Swapping Views
      14. Recipe: Flipping Views
      15. Recipe: Using Core Animation Transitions
      16. Recipe: Bouncing Views as They Appear
      17. Recipe: Image View Animations
      18. Summary
    13. 5. View Constraints
      1. What Are Constraints?
      2. Alignment Rectangles
      3. Constraint Attributes
      4. The Laws of Constraints
      5. Creating Constraints
      6. Format Strings
      7. Predicates
      8. Format String Summary
      9. Storing and Updating Constraints
      10. Recipe: Comparing Constraints
      11. Recipe: Describing Constraints
      12. Recipe: Creating Fixed-Size Constrained Views
      13. Recipe: Centering Views
      14. Recipe: Setting Aspect Ratio
      15. Aligning Views and Flexible Sizing
      16. Recipe: Responding to Orientation Changes
      17. Constraint Macros
      18. Debugging Your Constraints
      19. Summary
    14. 6. Text Entry
      1. Recipe: Dismissing a UITextField Keyboard
      2. Recipe: Dismissing Text Views with Custom Accessory Views
      3. Recipe: Adjusting Views Around Keyboards
      4. Recipe: Adjusting Views Around Accessory Views
      5. Recipe: Creating a Custom Input View
      6. Recipe: Making Text-Input-Aware Views
      7. Recipe: Adding Custom Input Views to Nontext Views
      8. Recipe: Building a Better Text Editor (Part I)
      9. Recipe: Building a Better Text Editor (Part II)
      10. Recipe: Text-Entry Filtering
      11. Recipe: Detecting Text Patterns
      12. Recipe: Detecting Misspelling in a UITextView
      13. Searching for Text Strings
      14. Summary
    15. 7. Working with View Controllers
      1. View Controllers
      2. Developing with Navigation Controllers and Split Views
      3. Recipe: The Navigation Item Class
      4. Recipe: Modal Presentation
      5. Recipe: Building Split View Controllers
      6. Recipe: Creating Universal Split View/Navigation Apps
      7. Recipe: Tab Bars
      8. Remembering Tab State
      9. Recipe: Page View Controllers
      10. Recipe: Scrubbing Pages in a Page View Controller
      11. Recipe: Custom Containers
      12. Recipe: Segues
      13. Summary
    16. 8. Common Controllers
      1. Image Picker Controller
      2. Recipe: Selecting Images
      3. Recipe: Snapping Photos
      4. Recipe: Recording Video
      5. Recipe: Playing Video with Media Player
      6. Recipe: Editing Video
      7. Recipe: Picking and Editing Video
      8. Recipe: E-Mailing Pictures
      9. Recipe: Sending a Text Message
      10. Recipe: Posting Social Updates
      11. Recipe: Activity View Controller
      12. Recipe: The Quick Look Preview Controller
      13. Summary
    17. 9. Accessibility
      1. Accessibility 101
      2. Enabling Accessibility
      3. Traits
      4. Labels
      5. Hints
      6. Testing with the Simulator
      7. Broadcasting Updates
      8. Testing Accessibility on the iPhone
      9. Summary
    18. 10. Creating and Managing Table Views
      1. iOS Tables
      2. Delegation
      3. Creating Tables
      4. Recipe: Implementing a Basic Table
      5. Table View Cells
      6. Recipe: Creating Checked Table Cells
      7. Working with Disclosure Accessories
      8. Recipe: Table Edits
      9. Recipe: Working with Sections
      10. Recipe: Searching Through a Table
      11. Recipe: Adding Pull-to-Refresh to Your Table
      12. Recipe: Adding Action Rows
      13. Coding a Custom Group Table
      14. Recipe: Building a Multiwheel Table
      15. Using the UIDatePicker
      16. Summary
    19. 11. Collection Views
      1. Collection Views Versus Tables
      2. Establishing Collection Views
      3. Flow Layouts
      4. Recipe: Basic Collection View Flows
      5. Recipe: Custom Cells
      6. Recipe: Scrolling Horizontal Lists
      7. Recipe: Introducing Interactive Layout Effects
      8. Recipe: Scroll Snapping
      9. Recipe: Creating a Circle Layout
      10. Recipe: Adding Gestures to Layout
      11. Recipe: Creating a True Grid Layout
      12. Recipe: Custom Item Menus
      13. Summary
    20. 12. A Taste of Core Data
      1. Introducing Core Data
      2. Entities and Models
      3. Creating Contexts
      4. Adding Data
      5. Querying the Database
      6. Removing Objects
      7. Recipe: Using Core Data for a Table Data Source
      8. Recipe: Search Tables and Core Data
      9. Recipe: Adding Edits to Core Data Table Views
      10. Recipe: A Core Data-Powered Collection View
      11. Summary
    21. 13. Networking Basics
      1. Recipe: Checking Your Network Status
      2. Scanning for Connectivity Changes
      3. Recipe: Synchronous Downloads
      4. Recipe: Asynchronous Downloads
      5. One-Call No-Feedback Asynchronous Downloads
      6. Recipe: Using JSON Serialization
      7. Recipe: Converting XML into Trees
      8. Summary
    22. Appendix. Objective-C Literals
      1. Numbers
      2. Boxing
      3. Container Literals
      4. Subscripting
      5. Feature Tests
    23. Index