iOS Programming: The Big Nerd Ranch Guide

Book description

Winner of a 2012 Jolt Productivity Award!

Updated and expanded to cover iOS 5 and Xcode 4.3, iOS Programming: The Big Nerd Ranch Guide leads you through the essential concepts, tools, and techniques for developing iOS applications. After completing this book, you will have the understanding, the know-how, and the confidence you need to tackle iOS projects of your own.

Based on Big Nerd Ranch’s popular iOS Bootcamp course and its well-tested materials and methodology, this best-selling guide teaches iOS concepts and coding in tandem. The result is instruction that is relevant and useful.

Throughout the book, the authors clearly explain what’s important to know and share their insights into the larger context of the iOS platform. This gives you a real understanding of how iOS development works, the many features that are available, and when and where to apply what you’ve learned.

Here are some of the topics covered:

  • Xcode 4.3, Instruments, and Storyboards

  • ARC, strong and weak references, and retain cycles

  • Interfacing with iCloud

  • Handling touch events and gestures

  • Tool bars, navigation controllers, and split view controllers

  • Localization and Internationalization

  • Block syntax and use

  • Background execution and multi-tasking

  • Saving/loading data: Archiving and Core Data

  • Core Location and Map Kit

  • Communicating with web services

  • Working with XML, JSON, and NSRegularExpression

  •   Using the Model-View-Controller-Store design pattern

  • Table of contents

    1. Title Page
    2. Acknowledgments
    3. Introduction
      1. Prerequisites
      2. What’s Changed in the Third Edition?
      3. Our Teaching Philosophy
      4. How To Use This Book
      5. Using an eBook
      6. How This Book Is Organized
      7. Style Choices
      8. Typographical Conventions
      9. Necessary Hardware and Software
    4. 1. A Simple iOS Application
      1. Creating an Xcode Project
      2. Building Interfaces
      3. Model-View-Controller
      4. Declarations
        1. Declaring instance variables
        2. Declaring methods
      5. Making Connections
        1. Setting pointers
        2. Setting targets and actions
        3. Summary of connections
      6. Implementing Methods
      7. Build and Run on the Simulator
      8. Deploying an Application
      9. Application Icons
      10. Launch Images
    5. 2. Objective-C
      1. Objects
      2. Using Instances
        1. Creating objects
        2. Sending messages
        3. Destroying objects
      3. Beginning RandomPossessions
        1. Creating strings
        2. Format strings
        3. NSArray and NSMutableArray
      4. Subclassing an Objective-C Class
        1. Creating an NSObject subclass
        2. Instance variables
        3. Accessor methods
        4. Instance methods
        5. Initializers
          1. id
          2. isa
          3. Implementing the designated initializer
          4. self
          5. super
        6. Other initializers and the initializer chain
        7. Using Initializers
        8. Class methods
        9. Testing your subclass
      5. Exceptions and Unrecognized Selectors
      6. Fast Enumeration
      7. Challenges
      8. Bronze Challenge: Bug Finding
      9. Silver Challenge: Another initializer
      10. Gold Challenge: Another Class
      11. Are You More Curious?
      12. For the More Curious: Class Names
    6. 3. Managing Memory with ARC
      1. The Heap
      2. The Stack
      3. Pointer Variables and Object Ownership
      4. Memory Management
        1. Using ARC for memory management
        2. How objects lose owners
      5. Strong and Weak References
      6. Properties
        1. Declaring properties
        2. Synthesizing properties
        3. Instance variables and properties
      7. Copying
      8. Dot Syntax
      9. For the More Curious: Autorelease Pool and ARC History
    7. 4. Delegation and Core Location
      1. Projects, Targets, and Frameworks
      2. Core Location
        1. Receiving updates from CLLocationManager
      3. Delegation
        1. Protocols
          1. Protocol methods
        2. Delegation, controllers, and memory management
      4. Using the Debugger
        1. Using breakpoints
          1. Stepping through code
        2. Diagnosing crashes and exceptions
      5. Bronze Challenge: Distance Filter
      6. Silver Challenge: Heading
      7. For the More Curious: Build Phases, Compiler Errors, and Linker Errors
        1. Preprocessing
        2. Compiling
        3. Linking
    8. 5. MapKit and Text Input
      1. Object Diagrams
      2. MapKit Framework
      3. Interface Properties
      4. Being a MapView Delegate
        1. Using the documentation
        2. Your own MKAnnotation
        3. Tagging locations
        4. Putting the pieces together
      5. Bronze Challenge: Map Type
      6. Silver Challenge: Changing the Map Type
      7. Gold Challenge: Annotation Extras
    9. 6. Subclassing UIView and UIScrollView
      1. Views and the View Hierarchy
      2. Creating a Custom View
      3. The drawRect: Method
      4. Core Graphics
      5. UIKit Drawing Additions
      6. Redrawing Views
      7. Motion Events
      8. Using UIScrollView
        1. Panning and paging
        2. Zooming
      9. Hiding the Status Bar
      10. Bronze Challenge: Colors
      11. Silver Challenge: Shapes
      12. Gold Challenge: Another View and Curves
    10. 7. View Controllers
      1. UIViewController
        1. Creating HypnoTime
        2. Subclassing UIViewController
        3. Another UIViewController
          1. Demystifying the XIB: File's Owner
      2. UITabBarController
      3. View Controller Lifecycle
        1. Initializing view controllers
        2. UIViewController and lazy loading
          1. Unloading views
          2. Appearing and disappearing views
      4. View Controller Subclasses and Templates
      5. Bronze Challenge: Another Tab
      6. Silver Challenge: Controller Logic
      7. For the More Curious: The main Function and UIApplication
      8. For the More Curious: Retina Display
    11. 8. Notification and Rotation
      1. Notification Center
      2. UIDevice Notifications
      3. Autorotation
        1. Setting autoresizing masks programmatically and bitwise operations
      4. Forcing Landscape Mode
      5. Bronze Challenge: Proximity Notifications
      6. Silver Challenge: Programmatically Setting Autoresizing Masks
      7. Gold Challenge: Overriding Autorotation
      8. For the More Curious: Overriding Autorotation
    12. 9. UITableView and UITableViewController
      1. Beginning the Homepwner Application
      2. UITableViewController
        1. Subclassing UITableViewController
      3. UITableView’s Data Source
        1. Creating BNRItemStore
        2. Implementing data source methods
      4. UITableViewCells
        1. Creating and retrieving UITableViewCells
        2. Reusing UITableViewCells
      5. Code Snippet Library
      6. Bronze Challenge: Sections
      7. Silver Challenge: Constant Rows
      8. Gold Challenge: Customizing the Table
    13. 10. Editing UITableView
      1. Editing Mode
      2. Adding Rows
      3. Deleting Rows
      4. Moving Rows
      5. Bronze Challenge: Renaming the Delete Button
      6. Silver Challenge: Preventing Reordering
      7. Gold Challenge: Really Preventing Reordering
    14. 11. UINavigationController
      1. UINavigationController
      2. An Additional UIViewController
      3. Navigating with UINavigationController
        1. Pushing view controllers
        2. Passing data between view controllers
        3. Appearing and disappearing views
      4. UINavigationBar
      5. Bronze Challenge: Displaying a Number Pad
      6. Silver Challenge: Dismissing a Number Pad
      7. Gold Challenge: Pushing More View Controllers
    15. 12. Camera
      1. Displaying Images and UIImageView
        1. Taking pictures and UIImagePickerController
        2. Creating BNRImageStore
        3. NSDictionary
        4. Creating and using keys
        5. Core Foundation and toll-free bridging
        6. Wrapping up BNRImageStore
        7. Dismissing the keyboard
      2. Bronze Challenge: Editing an Image
      3. Silver Challenge: Removing an Image
      4. Gold Challenge: Camera Overlay
      5. For the More Curious: Recording Video
    16. 13. UIPopoverController and Modal View Controllers
      1. Universalizing Homepwner
        1. Determining device family
      2. UIPopoverController
      3. More Modal View Controllers
        1. Dismissing modal view controllers
        2. Modal view controller styles
        3. Completion blocks
        4. Modal view controller transitions
      4. Bronze Challenge: Universalizing Whereami
      5. Silver Challenge: Peeling Aways the Layers
      6. Gold Challenge: Popover Appearance
      7. For the More Curious: View Controller Relationships
        1. Parent-child relationships
        2. Presenting-presenter relationships
        3. Inter-family relationships
    17. 14. Saving, Loading, and Application States
      1. Archiving
      2. Application Sandbox
        1. Constructing a file path
      3. NSKeyedArchiver and NSKeyedUnarchiver
      4. Application States and Transitions
      5. Writing to the Filesystem with NSData
      6. More on Low-Memory Warnings
      7. Model-View-Controller-Store Design Pattern
      8. Bronze Challenge: PNG
      9. Silver Challenge: Archiving Whereami
      10. For The More Curious: Application State Transitions
      11. For the More Curious: Reading and Writing to the Filesystem
      12. For the More Curious: The Application Bundle
    18. 15. Subclassing UITableViewCell
      1. Creating HomepwnerItemCell
        1. Configuring a UITableViewCell subclass’s interface
        2. Exposing the properties of HomepwnerItemCell
        3. Using HomepwnerItemCell
      2. Image Manipulation
      3. Relaying Actions from UITableViewCells
        1. Adding pointers to cell subclass
        2. Relaying the message to the controller
        3. Objective-C selector magic
        4. Presenting the image in a popover controller
      4. Bronze Challenge: Color Coding
      5. Silver Challenge: Cell Base Class
      6. Gold Challenge: Zooming
    19. 16. Core Data
      1. Object-Relational Mapping
      2. Moving Homepwner to Core Data
        1. The model file
        2. NSManagedObject and subclasses
        3. Updating BNRItemStore
          1. NSFetchRequest and NSPredicate
          2. Adding and deleting items
          3. Reordering items
        4. Adding BNRAssetTypes to Homepwner
      3. More About SQL
      4. Faults
      5. Trade-offs of Persistence Mechanisms
      6. Bronze Challenge: Assets on the iPad
      7. Silver Challenge: New Asset Types
      8. Gold Challenge: Showing Assets of a Type
    20. 17. Localization
      1. Internationalization Using NSLocale
      2. Localizing Resources
      3. NSLocalizedString and Strings Tables
      4. Bronze Challenge: Another Localization
      5. For the More Curious: NSBundle’s Role in Internationalization
    21. 18. NSUserDefaults
      1. Updating Whereami
      2. Using NSUserDefaults
      3. Silver Challenge: Initial Location
      4. Gold Challenge: Concise Coordinates
      5. For the More Curious: The Settings Application
    22. 19. Touch Events and UIResponder
      1. Touch Events
      2. Creating the TouchTracker Application
      3. Drawing with TouchDrawView
      4. Turning Touches Into Lines
      5. The Responder Chain
      6. Bronze Challenge: Saving and Loading
      7. Silver Challenge: Colors
      8. Gold Challenge: Circles
      9. For the More Curious: UIControl
    23. 20. UIGestureRecognizer and UIMenuController
      1. UIGestureRecognizer Subclasses
      2. Detecting Taps with UITapGestureRecognizer
      3. UIMenuController
      4. UILongPressGestureRecognizer
      5. UIPanGestureRecognizer and Simultaneous Recognizers
      6. For the More Curious: UIMenuController and UIResponderStandardEditActions
      7. For the More Curious: More on UIGestureRecognizer
      8. Bronze Challenge: Clearing Lines
      9. Silver Challenge: Mysterious Lines
      10. Gold Challenge: Speed and Size
      11. Mega-Gold Challenge: Colors
    24. 21. Instruments
      1. Static Analyzer
      2. Instruments
        1. Allocations Instrument
          1. Settings in Allocations
          2. Heapshot analysis
        2. Time Profiler Instrument
        3. Leaks Instrument
      3. Xcode Schemes
        1. Creating a new scheme
      4. Build Settings
    25. 22. Core Animation Layer
      1. Layers and Views
      2. Creating a CALayer
      3. Layer Content
      4. Implicitly Animatable Properties
      5. Bronze Challenge: Another Layer
      6. Silver Challenge: Corner Radius
      7. Gold Challenge: Shadowing
      8. For the More Curious: Programmatically Generating Content
      9. For the More Curious: Layers, Bitmaps, and Contexts
    26. 23. Controlling Animation with CAAnimation
      1. Animation Objects
      2. Spinning with CABasicAnimation
        1. Timing functions
        2. Animation completion
      3. Bouncing with a CAKeyframeAnimation
      4. Bronze Challenge: More Animation
      5. Silver Challenge: Even More Animation
      6. Gold Challenge: Chaining Animations
      7. For the More Curious: The Presentation Layer and the Model Layer
    27. 24. UIStoryboard
      1. Creating a Storyboard
      2. UITableViewControllers in Storyboards
      3. Segues
      4. More on Storyboards
    28. 25. Web Services and UIWebView
      1. Web Services
        1. Starting the Nerdfeed application
        2. NSURL, NSURLRequest, and NSURLConnection
        3. Formatting URLs and requests
        4. Working with NSURLConnection
        5. Collecting XML data
        6. Parsing XML with NSXMLParser
        7. Constructing the tree of model objects
        8. A quick tip on logging
      2. UIWebView
      3. For the More Curious: NSXMLParser
      4. For the More Curious: The Request Body
      5. For the More Curious: Credentials
      6. Bronze Challenge: More Data
      7. Silver Challenge: More UIWebView
    29. 26. UISplitViewController and NSRegularExpression
      1. Splitting Up Nerdfeed
      2. Master-Detail Communication
      3. Displaying the Master View Controller in Portrait Mode
      4. Universalizing Nerdfeed
      5. NSRegularExpression
        1. Constructing a pattern string
      6. Bronze Challenge: Finding the Subforum
      7. Silver Challenge: Swapping the Master Button
      8. Silver Challenge: Processing the Reply
      9. Gold Challenge: Showing Threads
    30. 27. Blocks
      1. Blocks and Block Syntax
        1. Declaring block variables
        2. Defining block literals
        3. Executing blocks
        4. More notes about blocks
      2. Basics of Using Blocks
      3. Variable Capturing
      4. Typical Block Usage
      5. For the More Curious: The __block Modifier, Abbreviated Syntax, and Memory
      6. For the More Curious: Pros and Cons of Callback Options
    31. 28. Model-View-Controller-Store
      1. The Need for Stores
      2. Creating BNRFeedStore
      3. Using the Store
      4. Building BNRFeedStore
        1. Initiating the connection
          1. The actor design pattern
          2. Handling the response
        2. Another request
      5. JSON Serialization
      6. More on Store Objects
      7. Bronze Challenge: UI for Song Count
      8. Mega-Gold Challenge: Another Web Service
      9. For the More Curious: JSON Data
    32. 29. Advanced MVCS
      1. Caching the RSS Feed
      2. Advanced Caching
        1. NSCopying
        2. Finishing the BNR feed
      3. Read and Unread Items
      4. Other Benefits of Store Objects
      5. Bronze Challenge: Pruning the Cache
      6. Silver Challenge: Favorites
      7. Gold Challenge: JSON Caching
      8. For the More Curious: Designing a Store Object
        1. Determining external sources
        2. Determining singleton status
        3. Determining how to deliver results
      9. For the More Curious: Automatic Caching and Cache.db
    33. 30. iCloud
      1. iCloud Requirements
      2. Ubiquity Containers
      3. Provisioning a Ubiquity Container
      4. Core Data and iCloud
      5. For the More Curious: iCloud Backups
    34. 31. Afterword
      1. What to do next
      2. Shameless plugs
    35. Index
    36. More From Big Nerd Ranch...

    Product information

    • Title: iOS Programming: The Big Nerd Ranch Guide
    • Author(s):
    • Release date: March 2012
    • Publisher(s): Big Nerd Ranch Guides
    • ISBN: 9780132978767