iOS Programming: The Big Nerd Ranch Guide

Book description

Updated and expanded to cover iOS 7 and Xcode 5, 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 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 bestselling guide teaches iOS concepts and coding in tandem. The result is instruction that is relevant and useful.

Throughout the book, the authors explain what's important and share their insights into the larger context of the iOS platform. You get 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 5, Instruments, and Storyboards

  • Building interfaces using the iOS 7 aesthetic

  • ARC and strong and weak references

  • Handling touch events and gestures

  • Toolbars, navigation controllers, and split view controllers

  • Using Auto Layout to scale user interfaces

  • Using Dynamic Type to scale fonts

  • Localization and Internationalization

  • Block syntax and use

  • Saving/loading data: Archiving and Core Data

  • Core Location and Map Kit

  • Communicating with web services using JSON

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

  • Table of contents

    1. Title Page
    2. Acknowledgments
    3. Introduction
      1. Prerequisites
      2. What has Changed in the Fourth 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. Model-View-Controller
      3. Designing Quiz
      4. Creating a View Controller
      5. Building an Interface
        1. Creating view objects
        2. Configuring view objects
        3. NIB files
        4. Making connections
          1. Declaring outlets
          2. Setting outlets
          3. Defining action methods
          4. Setting targets and actions
          5. Summary of connections
      6. Creating Model Objects
        1. Using code-completion
      7. Pulling it all Together
        1. Implementing action methods
        2. Getting the view controller on the screen
      8. Running on the Simulator
      9. Deploying an Application
      10. Application Icons
      11. Launch Images
    5. 2. Objective-C
      1. Objects
      2. Using Instances
        1. Creating objects
        2. Sending messages
        3. Destroying objects
      3. Beginning RandomItems
        1. Creating and populating an array
        2. Iterating over an array
        3. Format strings
      4. Subclassing an Objective-C Class
        1. Creating an NSObject subclass
        2. Instance variables
        3. Accessing instance variables
          1. Using dot syntax
        4. Class vs. instance methods
        5. Overriding methods
        6. Initializers
          1. The designated initializer
          2. instancetype
          3. id
          4. Implementing the designated initializer
          5. self
          6. super
          7. Confirming initialization success
          8. Instance variables in initializers
          9. Other initializers and the initializer chain
          10. Using initializers
        7. Class methods
        8. Testing your subclass
      5. More on NSArray and NSMutableArray
      6. Exceptions and Unrecognized Selectors
      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
      13. For the More Curious: #import and @import
    6. 3. Managing Memory with ARC
      1. The Stack
      2. The Heap
        1. ARC and memory management
      3. Pointer Variables and Object Ownership
        1. How objects lose owners
          1. Changing a pointer
          2. Setting a pointer to nil
          3. The owner is destroyed
          4. Removing an object from a collection
        2. Ownership chains
      4. Strong and Weak References
      5. Properties
        1. Declaring properties
        2. Property attributes
          1. Multi-threading attribute
          2. Read/write attribute
          3. Memory management attribute
        3. Custom accessors with properties
      6. For the More Curious: Property Synthesis
      7. For the More Curious: Autorelease Pool and ARC History
    7. 4. Views and the View Hierarchy
      1. View Basics
      2. The View Hierarchy
      3. Subclassing UIView
        1. Views and frames
      4. Custom Drawing in drawRect:
        1. Drawing a single circle
        2. UIBezierPath
        3. Using the developer documentation
        4. Drawing concentric circles
      5. More Developer Documentation
      6. Bronze Challenge: Draw an Image
      7. For the More Curious: Core Graphics
      8. Gold Challenge: Shadows and Gradients
    8. 5. Views: Redrawing and UIScrollView
      1. The Run Loop and Redrawing Views
      2. Class Extensions
      3. Using UIScrollView
        1. Panning and paging
    9. 6. View Controllers
      1. Subclassing UIViewController
        1. The view of a view controller
        2. Creating a view programmatically
        3. Setting the root view controller
      2. Another UIViewController
        1. Creating a view in Interface Builder
          1. Creating view objects
          2. Loading a NIB file
          3. Connecting to File's Owner
      3. UITabBarController
        1. Tab bar items
      4. UIViewController Initializers
      5. Adding a Local Notification
      6. Loaded and Appearing Views
        1. Accessing subviews
      7. Interacting with View Controllers and Their Views
      8. Bronze Challenge: Another Tab
      9. Silver Challenge: Controller Logic
      10. For the More Curious: Key-Value Coding
      11. For the More Curious: Retina Display
    10. 7. Delegation and Text Input
      1. Text Fields
        1. UIResponder
        2. Configuring the keyboard
      2. Delegation
      3. Protocols
      4. Adding the Labels to the Screen
      5. Motion Effects
      6. Using the Debugger
        1. Using breakpoints
        2. Stepping through code
          1. Deleting breakpoints
          2. Setting an exception breakpoint
      7. For the More Curious: main() and UIApplication
      8. Silver Challenge: Pinch to Zoom
    11. 8. 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
    12. 9. 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
    13. 10. 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
    14. 11. Camera
      1. Displaying Images and UIImageView
        1. Adding a camera button
      2. Taking Pictures and UIImagePickerController
        1. Setting the image picker’s sourceType
        2. Setting the image picker’s delegate
        3. Presenting the image picker modally
        4. Saving the image
      3. Creating BNRImageStore
      4. NSDictionary
      5. Creating and Using Keys
      6. Wrapping up BNRImageStore
      7. Dismissing the Keyboard
      8. Bronze Challenge: Editing an Image
      9. Silver Challenge: Removing an Image
      10. Gold Challenge: Camera Overlay
      11. For the More Curious: Navigating Implementation Files
        1. #pragma mark
      12. For the More Curious: Recording Video
    15. 12. Touch Events and UIResponder
      1. Touch Events
      2. Creating the TouchTracker Application
      3. Drawing with BNRDrawView
      4. Turning Touches into Lines
        1. Handling multiple touches
      5. Bronze Challenge: Saving and Loading
      6. Silver Challenge: Colors
      7. Gold Challenge: Circles
      8. For the More Curious: The Responder Chain
      9. For the More Curious: UIControl
    16. 13. UIGestureRecognizer and UIMenuController
      1. UIGestureRecognizer Subclasses
      2. Detecting Taps with UITapGestureRecognizer
      3. Multiple Gesture Recognizers
      4. UIMenuController
      5. UILongPressGestureRecognizer
      6. UIPanGestureRecognizer and Simultaneous Recognizers
      7. For the More Curious: UIMenuController and UIResponderStandardEditActions
      8. For the More Curious: More on UIGestureRecognizer
      9. Silver Challenge: Mysterious Lines
      10. Gold Challenge: Speed and Size
      11. Mega-Gold Challenge: Colors
    17. 14. Debugging Tools
      1. Gauges
      2. Instruments
        1. Allocations instrument
          1. Generation analysis
        2. Time Profiler instrument
        3. Leaks instrument
      3. Static Analyzer
      4. Projects, Targets, and Build Settings
        1. Build configurations
        2. Changing a build setting
    18. 15. Introduction to Auto Layout
      1. Universalizing Homepwner
      2. The Auto Layout System
        1. Alignment rectangle and layout attributes
        2. Constraints
      3. Adding Constraints in Interface Builder
        1. Adding more constraints
        2. Adding even more constraints
        3. Priorities
      4. Debugging Constraints
        1. Ambiguous layout
        2. Unsatisfiable constraints
        3. Misplaced views
      5. Bronze Challenge: Practice Makes Perfect
      6. Silver Challenge: Universalize Quiz
      7. For the More Curious: Debugging Using the Auto Layout Trace
      8. For the More Curious: Multiple XIB Files
    19. 16. Auto Layout: Programmatic Constraints
      1. Visual Format Language
      2. Creating Constraints
      3. Adding Constraints
      4. Intrinsic Content Size
      5. The Other Way
      6. For the More Curious: NSAutoresizingMaskLayoutConstraint
    20. 17. Autorotation, Popover Controllers, and Modal View Controllers
      1. Autorotation
      2. Rotation Notification
      3. UIPopoverController
      4. More Modal View Controllers
        1. Dismissing modal view controllers
        2. Modal view controller styles
        3. Completion blocks
        4. Modal view controller transitions
      5. Thread-Safe Singletons
      6. Bronze Challenge: Another Thread-Safe Singleton
      7. Gold Challenge: Popover Appearance
      8. For the More Curious: Bitmasks
      9. For the More Curious: View Controller Relationships
        1. Parent-child relationships
        2. Presenting-presenter relationships
        3. Inter-family relationships
    21. 18. 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. NSNotificationCenter and Low-Memory Warnings
        1. More on NSNotificationCenter
      7. Model-View-Controller-Store Design Pattern
      8. Bronze Challenge: PNG
      9. For the More Curious: Application State Transitions
      10. For the More Curious: Reading and Writing to the Filesystem
      11. For the More Curious: The Application Bundle
    22. 19. Subclassing UITableViewCell
      1. Creating BNRItemCell
        1. Configuring a UITableViewCell subclass’s interface
        2. Exposing the properties of BNRItemCell
        3. Using BNRItemCell
        4. Constraints for BNRItemCell
      2. Image Manipulation
      3. Relaying Actions from UITableViewCells
        1. Adding a block to the cell subclass
        2. Presenting the image in a popover controller
      4. Variable Capturing
      5. Bronze Challenge: Color Coding
      6. Gold Challenge: Zooming
      7. For the More Curious: UICollectionView
    23. 20. Dynamic Type
      1. Using Preferred Fonts
      2. Responding to User Changes
      3. Updating Auto Layout
        1. Content Hugging and Compression Resistance Priorities revisited
      4. Determining the User’s Preferred Text Size
      5. Updating BNRItemCell
        1. Constraint outlets
        2. Placeholder constraints
    24. 21. Web Services and UIWebView
      1. Web Services
        1. Starting the Nerdfeed application
        2. NSURL, NSURLRequest, NSURLSession, and NSURLSessionTask
        3. Formatting URLs and requests
        4. Working with NSURLSession
        5. JSON data
        6. Parsing JSON data
        7. The main thread
      2. UIWebView
      3. Credentials
      4. Silver Challenge: More UIWebView
      5. Gold Challenge: Upcoming Courses
      6. For the More Curious: The Request Body
    25. 22. UISplitViewController
      1. Splitting Up Nerdfeed
      2. Displaying the Master View Controller in Portrait Mode
      3. Universalizing Nerdfeed
    26. 23. 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
    27. 24. State Restoration
      1. How State Restoration Works
      2. Opting In to State Restoration
      3. Restoration Identifiers and Classes
      4. State Restoration Life Cycle
      5. Restoring View Controllers
      6. Encoding Relevant Data
      7. Saving View States
      8. Silver Challenge: Another Application
      9. For the More Curious: Controlling Snapshots
    28. 25. Localization
      1. Internationalization Using NSNumberFormat
      2. Localizing Resources
      3. NSLocalizedString() and Strings Tables
      4. Bronze Challenge: Another Localization
      5. For the More Curious: NSBundle’s Role in Internationalization
      6. For the More Curious: Localizing XIB files without Base Internationalization
    29. 26. NSUserDefaults
      1. NSUserDefaults
        1. Register the factory settings
        2. Read a preference
        3. Change a preference
      2. Settings Bundle
        1. Editing the Root.plist
        2. Localized Root.strings
    30. 27. Controlling Animations
      1. Basic Animations
        1. Timing functions
      2. Keyframe Animations
      3. Animation Completion
      4. Spring Animations
      5. Silver Challenge: Improved Quiz
    31. 28. UIStoryboard
      1. Creating a Storyboard
      2. UITableViewControllers in Storyboards
      3. Segues
      4. Enabling Color Changes
      5. Passing Data Around
      6. More on Storyboards
      7. For the More Curious: State Restoration
    32. 29. Afterword
      1. What to do Next
      2. Shameless Plugs
    33. Index
    34. More From Big Nerd Ranch...

    Product information

    • Title: iOS Programming: The Big Nerd Ranch Guide
    • Author(s):
    • Release date: February 2014
    • Publisher(s): Big Nerd Ranch Guides
    • ISBN: 9780133491876