iOS SDK Programming A Beginners Guide

Book description

Essential Skills--Made Easy!

Develop, test, and debug iPhone, iPad, and iPod touch applications with help from this practical resource. iOS SDK Programming: A Beginner's Guide shows you how to use Objective-C and Apple's new Xcode 4 development environment with an integrated, easy-to-use Interface Builder. You'll learn which UIView subclasses to use when laying out an iOS app and master all of the iOS user interface controls. Setting application preferences and storing application data are also covered. The book explains how to integrate multimedia into your apps and develop universal apps that run on the iPhone, iPod touch, and iPad. You'll learn how to take advantage of the iPad's larger display and the new features of iOS 4.2. By the end of this book, you'll be ready to create the next bit hit in the iTunes App Store!

Designed for Easy Learning:

  • Key Skills & Concepts--Chapter-opening lists of specific skills covered in the chapter
  • Try This--Hands-on exercises that show you how to apply your skills
  • Notes--Extra information related to the topic being covered
  • Tips--Helpful reminders or alternate ways of doing things
  • Cautions--Errors and pitfalls to avoid
  • Annotated Syntax--Example code with commentary that describes the programming techniques being illustrated

Table of contents

  1. Cover page
  2. iOS SDK Programming: A Beginner’s Guide
  3. Copyright Page
  4. Dedication
  5. Contents
  6. Acknowledgments
  7. Introduction
  8. 1 The iOS Software Development Kit (SDK)
    1. The App Store
    2. The Software Development Kit (SDK)
      1. Paid Membership
    3. Objective-C, Foundation Framework, Cocoa Touch, and UIKit
      1. Cocoa Touch
      2. Foundation Framework
      3. The iOS Frameworks
      4. Memory and Processor Speed
      5. Small Screen
      6. Security
      7. Short-Lived Applications
      8. Manual Memory Management
    4. Relevant Documentation
    5. Try This: Getting a Quick Start on iOS Development
    6. Summary
  9. 2 A C Refresher
    1. C Command-Line Programs
    2. Try This: Creating a Simple C Program Using Xcode
    3. C Comments
    4. Understanding Headers, Import, and Include
    5. Try This: Creating a Header File
    6. Preprocessor Statements
    7. Try This: Using Preprocessor Statements
    8. Data Types and Operators
    9. Control, Functions, and Conditional Statements
    10. Arrays and Structures
    11. Functions
    12. The printf Statement
    13. Pointers
    14. Try This: Using Pointers
    15. Dereferencing a Pointer
    16. Pointers and Arrays
    17. Try This: Using an Array with Pointers
    18. Summary
  10. 3 Just Enough Objective-C: Part One
    1. Objective-C Classes and Objects
    2. Class Interface and Implementation
    3. Try This: Generating an Objective-C Class’ Interface and Implementation
    4. The @interface and @implementation Compiler Directives
    5. Method Declaration and Definition
    6. Try This: Adding SayHello to the Simple Class
    7. Interface Anatomy
    8. Implementation Anatomy
    9. Public, Private, and Protected Instance Variables
    10. Understanding Simple Messaging
    11. Using self in a Message
    12. Nested Arguments
    13. Class and Instance Methods
    14. Try This: Adding sayGoodBye as a Class Method
    15. The alloc and init Methods
    16. Managing Memory Using Retain and Release
    17. Try This: Using Manual Memory Management
    18. Instance Variables and Memory
    19. Managing Memory Using Autorelease
    20. Summary
  11. 4 Just Enough Objective-C: Part Two
    1. Properties
      1. Retain
      2. Assign
      3. Copy
      4. Releasing Properties
    2. Multiple-Argument Messages
    3. Try This: Creating a Simple Multiple-Argument Message
    4. Understanding the id Variable Type, Dynamic Typing, and Dynamic Binding
      1. The id Type
      2. Dynamic Binding and Dynamic Typing
    5. Understanding Inheritance
      1. Overriding Methods
      2. Overloading Methods
    6. Using Categories
    7. Using Protocols
    8. Handling Exceptions
    9. Summary
  12. 5 Deploying to an iPhone, Debugging, and Testing
    1. Installing Applications on an iPhone
      1. Membership
      2. Certificates, Devices, Application IDs, and Provisioning
    2. Try This: Deploying an Application to iPhone
    3. Debugging
      1. Using the Debugger
    4. Try This: Debugging an Application
      1. NSZombieEnabled
    5. Try This: Enabling Zombies
      1. Instruments—Leaks
    6. Try This: Find a Memory Leak
    7. Distributing Your Application
      1. Ad Hoc Deployment and Testing
      2. Distributing Your App via the App Store
    8. Summary
  13. 6 UIApplication and UIApplicationDelegate
    1. Try This: Adding a UIView and UIViewController to a UIApplicationDelegate
    2. Connecting UIWindow, UIApplication, and UIApplicationDelegate
    3. Try This: Exploring Main Window.xib
    4. UIApplication and UIApplicationDelegate
      1. The main.m File
      2. Handling Application Life Cycle Events
      3. Application Interruptions
    5. Try This: Handling Application Interruptions
    6. Summary
  14. 7 UIView and UIViewController
    1. The UIView Class
    2. The UIViewController Class
    3. View-Based Application Template
    4. IBOutlet and IBAction
    5. Try This: Using a View-Based Application Template
    6. Try This: Using a Window-Based Application Template
    7. UIViewController and Application Life Cycle Events
    8. Try This: Exploring Several Life Cycle Methods
    9. Summary
  15. 8 UITabBar and UITabBarController
    1. UITabBar, UITabBarController, UITabBarItem, and UITabBarControllerDelegate
    2. Try This: Using the Tab Bar Application Template
    3. Try This: Adding a Tab Bar Item to a Tab Bar Application
    4. Try This: Creating a Tab Bar Application from Scratch
    5. Try This: Allowing Users to Customize a Tab Bar
    6. Summary
  16. 9 UINavigationBar and UINavigationController
    1. UINavigationBar, UINavigationController, and UINavigationItem
    2. Try This: Building a Three-View Application Using a Navigation Bar
      1. Adding Another View
    3. Try This: See How a Utility Application Uses NavigationBar
    4. More on the UINavigationController
      1. Popping View Controllers
      2. Configuring the Navigation Bar
    5. Try This: Using a Navigation Controller in a Tab
    6. Summary
  17. 10 Tables Using UITableView and UITableViewController
    1. UITableView
    2. UITableViewDelegate and UITableViewDataSource
      1. UITableViewDelegate
      2. UITableViewDataSource
    3. Try This: Adopting the UITableViewDelegate and UITableViewDataSource
    4. Try This: Adding a Delegate and Data Source
    5. UITableViewController
    6. Try This: Using a UITableViewController
    7. Grouping and Indexing
      1. Grouped Table Style
    8. Try This: Grouping
      1. Indexing
    9. Try This: Indexing
    10. Images in Tables
    11. Try This: Adding an Image
    12. Selecting Rows
    13. Try This: Row Selection
    14. Changing Row Height
    15. Try This: Changing Row Height
    16. Accessorizing Table Cells
    17. Try This: Accessorizing a Table Cell
    18. Customizing a Table Cell
    19. Try This: Customizing a Cell Using Interface Builder
    20. Using Tables with Navigation Bars and Tabs
    21. Try This: Using a Table in a Navigation Controller in a Tab
    22. Editing Table Cells
      1. Getting to Edit Mode
      2. Edit Mode Methods
    23. Try This: Editing Rows
    24. Summary
  18. 11 Activity Progress and Alerting Users
    1. Showing Activity—the UIActivityIndicatorView
    2. Try This: Using a UIActivitylndicatorView
    3. Showing Progress—the UIProgressView
    4. Try This: Using a UIProgress View
    5. Alerting Users
    6. UIAlertView and UIAlertViewDelegate
    7. Try This: Creating a Simple UIAlertView
    8. Try This: Using an Alert with Multiple Buttons
    9. UIActionSheet and UIActionSheetDelegate
    10. Try This: Using a UIActionSheet
    11. Application Badges
    12. Try This: Adding an Application Badge
    13. Summary
  19. 12 Controls—Part One: Using Buttons, Sliders, Switches, and Text Fields
    1. Buttons
      1. UIButton with a Background Image and Image
    2. Try This: Using a Custom Button Background Image and Image
    3. Button Types
    4. UIToolBar
    5. Try This: Creating a UIToolbar
    6. UISwitch
    7. UISlider
      1. Appearance
      2. Values
      3. Continuous Property
    8. Try This: Using a Switch and a Slider
    9. UITextField
    10. Try This: Using UITextField (with a Number Pad)
    11. UITextView
    12. UISegmentedControl
    13. Try This: Using a UISegmentedControl
    14. The Web View
      1. UIWebView
      2. UIWebViewDelegate
    15. Try This: Creating a Simple Web Browser
    16. Summary
  20. 13 Controls—Part Two: Using Pickers and Using the Camera
    1. Using Pickers: Date Pickers and Pickers
      1. Date Pickers
    2. Try This: Using a Date Picker
    3. Try This: Using a UIDatePicker in Timer Mode
      1. UIPickerView
    4. Try This: Using a Picker
    5. Try This: Using a UIPickerView with Two Components
    6. Try This: Loading UIImageViews into a UIPickerView
    7. Using the Camera: UIImagePickerController
      1. UIImagePickerController
      2. UIImagePickerControllerDelegate
    8. Try This: Using the UIImagePickerController
    9. Try This: Using Notifications
    10. Summary
  21. 14 Application Settings
    1. The Settings Application
    2. The Settings Bundle
    3. Try This: Creating a Settings Bundle
      1. Settings Field Types
    4. Try This: Adding a PSTextFieldSpecifier
      1. PSMultiValueSpecifier
    5. Try This: Adding a PSMultiValueSpecifier
      1. PSToggleSwitchSpecifier
    6. Try This: Adding a PSToggleSwitchSpecifier
      1. PSSliderSpecifier
    7. Try This: Adding a PSSliderSpecifier
      1. PSChildPaneSpecifier
    8. Try This: Adding a PSChildPaneSpecifier
    9. Reading Settings Using NSUserDefaults
    10. Try This: Reading the Settings Bundle
      1. Changed Settings While Suspended
    11. Summary
  22. 15 Property Lists and Archiving
    1. An iOS Application’s Directory Structure
      1. Directories
    2. Property Lists
      1. Simple Serialization
    3. Try This: Preserving an NSArray
      1. NSPropertyListSerialization
    4. Try This: Preserving to an XML Property List
    5. Archiving
      1. Protocols to Adopt
      2. NSKeyedArchiver and NSKeyedUnarchiver
    6. Try This: Archiving and Unarchiving an Object
    7. Try This: Archiving and Unarchiving an Object Hierarchy
      1. Multitasking and Saving Application State
    8. Summary
  23. 16 Data Persistence Using SQLite
    1. Adding a SQLite Database
    2. Try This: Creating a Simple Database Using FireFox SQLite Manager
    3. Basic SQLite Database Manipulation
      1. Opening the Database
      2. Statements, Preparing Statements, and Executing Statements
      3. Select
    4. Try This: Opening and Querying a Database
      1. SQLite Binding, Inserting, Updating, and Deleting
    5. Try This: Inserting, Updating, and Deleting Records
    6. Try This: Inserting Records
    7. Try This: Updating Records
    8. Try This: Deleting Records
    9. Summary
  24. 17 Core Data
    1. Core Data in Brief
    2. Creating a Model
      1. Entities
      2. Attributes
      3. Relationships
    3. Try This: Adding Entities and Relationships to a Core Data Model
    4. Model, Context, and Store
      1. NSManagedObjectModel
      2. NSPersistentStoreCoordinator
      3. NSManagedObjectContext
      4. NSManagedObject
    5. NSFetchedResultsController
      1. NSFetchRequest
      2. NSPredicate
      3. NSSortDescriptor
    6. Try This: Fetching All AKCGroup Entities
    7. Adding Objects
    8. Saving Changes
    9. Deleting Entities
    10. Updating Entities
    11. Try This: Adding Navigation and AKCGroup Editing
    12. Navigation
    13. Try This: Adding Navigation and Editing for a List of Breeds
    14. Try This: Adding a Breed Detail View
    15. Distributing Core Data with Your App
    16. What Next?
    17. Summary
  25. 18 Multimedia
    1. Playing Sounds
      1. AudioServicesPlaySystemSound
      2. AVAudioPlayer and AVAudioPlayerDelegate
    2. Try This: Playing a Sound and an MP3
    3. Media Player Framework
      1. Media Data Classes
      2. Selecting Multimedia
      3. Playing Multimedia: MPMusicPlayerController
    4. Try This: Using the Media Picker and Media Player
      1. MPMoviePlayerController
    5. Try This: Play a Video
    6. Summary
  26. 19 Universal Applications for the iPad
    1. Creating a Universal Application
    2. Try This: Building an App for iPad and iPhone
      1. Handling Orientation Changes
    3. Try This: Reacting to Orientation Changes
      1. Icons and Default Screens
    4. Split Views
    5. Try This: Add a Split View
    6. Other iPad Features
      1. Using Popovers for Information or Editing
      2. Movies in a View
    7. Try This: MoviePlayer Centered on the iPad Screen
      1. External Display
      2. Working with Documents
    8. Summary
  27. Index

Product information

  • Title: iOS SDK Programming A Beginners Guide
  • Author(s): James Brannan, Blake Ward
  • Release date: January 2011
  • Publisher(s): McGraw-Hill
  • ISBN: 9780071759090