Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Learning Cocoa with Objective-C
Preface
Audience
Organization of This Book
Conventions Used in This Book
Using Code Examples
SafariĀ® Books Online
How to Contact Us
Acknowledgments
1. Cocoa Development Tools
The Mac and iOS Developer Programs
Registering for a Developer Program
Downloading Xcode from Apple Developer
Getting Around in Xcode
Creating Your First Cocoa Project
The Xcode Interface
The editor
The toolbar
The navigator
Utilities
The debug area
Developing a Simple Objective-C Application
Designing the Interface
Connecting the Code
Using the iOS Simulator
2. Object-Oriented Programming with Objective-C
Object-Oriented Programming
Objects
Inheritance
Interfaces and Implementations
Methods
Messages
Properties
Protocols
Class Extensions
Modules
Memory Management
Reference Counting
Automatic Reference Counting
Object Graphs in Objective-C
The NSObject Lifecycle
Allocation and Initialization
Retain and Release
Finalization and Deallocation
3. Foundation
Mutable and Immutable Objects
Strings
Creating Strings
Working with Strings
Capitalization and working with paths
Finding substrings
Comparing Strings
Searching Strings
Arrays
Fast Enumeration
Mutable Arrays
Dictionaries
NSValue and NSNumber
Data
Loading Data from Files and URLs
Serialization and Deserialization
Design Patterns in Cocoa
Model-View-Controller
Delegation
Key-Value Observing
4. Applications on OS X and iOS
What Is an Application?
Applications, Frameworks, Utilities, and More
What Are Apps Composed Of?
Using NSBundle to Find Resources in Applications
The Application Lifecycle
OS X Applications
iOS Applications
Multitasking on iOS
The Application Sandbox
Application Restrictions
iOS application restrictions
Mac application restrictions
Private APIs
5. Graphical User Interfaces
Interfaces in OS X and iOS
MVC and Application Design
Nib Files
Structure of a Nib File
Storyboards
Outlets and Actions
How Nib Files Are Loaded
Constructing an Interface
Guidelines and Constraints
Building an App with Nibs and Constraints
UI Dynamics
UI and Gravity
Snapping UI
Designing Interfaces for Both iOS 6 and 7
Core Animation
Layers
Animations
Animations on OS X
Animations on iOS
6. Blocks and Operation Queues
Blocks
Block Syntax
Block Lifecycles
Methods with Block Parameters
Blocks and Memory Management
Modifying Local Variables from Inside Blocks with __block
Concurrency with Operation Queues
Operation Queues and NSOperation
Performing Work on Operation Queues
Putting It All Together
7. Drawing Graphics in Views
How Drawing Works
The Pixel Grid
Retina Displays
Pixels and Screen Points
Drawing in Views
Frame Rectangles
Bounds Rectangles
Building a Custom View
Creating the Project
Filling with a Solid Color
Working with Paths
Creating Custom Paths
Multiple Subpaths
Shadows
Saving and restoring graphics contexts
Drawing a shadow
Drawing shadows on iOS
Gradients
Drawing gradients on iOS
Transforms
SpriteKit
8. Audio and Video
AV Foundation
Playing Video with AVPlayer
AVPlayerLayer
Putting It Together
AVPlayerView
Playing Sound with AVAudioPlayer
Speech Synthesis
Working with the Photo Library
Capturing Photos and Video from the Camera
Building a Photo Application
The Photo Library
9. Model Objects and Data Storage
Key-Value Coding
Key-Value Observing
Registering for Change Notifications
Notifying Observers of Changes
Notifications with NSNotification
Preferences
Registering Default Preferences
Accessing Preferences
Setting Preferences
Working with the Filesystem
Using NSFileManager
Creating directories
Creating files
Removing files
Moving and copying files
File Storage Locations
Working with the Sandbox
Enabling Sandboxing
Open and Save Panels
Security-Scoped Bookmarks
10. Cocoa Bindings
Binding Views to Models
A Single Bindings App
Binding to Controllers
Array and Object Controllers
A More Complex Bindings App
11. Table Views and Collection Views
Data Sources and Delegates
Table Views
UITableView on iOS
Sections and Rows
Table View Controllers
Table View Cells
Cell reuse
Anatomy of a UITableViewCell
Preparing table views in Interface Builder
Analyzing tableView:cellForRowAtIndexPath:
Responding to actions
Implementing a Table View
NSTableView on OS X
Sorting a Table View
NSTableView with Bindings
Collection Views
UICollectionView on iOS
12. Document-Based Applications
The NSDocument and UIDocument Classes
Document Objects in MVC
Kinds of Documents
The Role of Documents
Document-Based Applications on OS X
Autosaving and Versions
Representing Documents with NSDocument
Saving Simple Data
Saving More Complex Data
Document-Based Applications on iOS
13. Networking
Connections
NSURL
NSURLRequest
NSURLConnection
NSURLSession
NSURLResponse and NSHTTPURLResponse
Building a Networked Application
Bonjour Service Discovery
Browsing for Shared iTunes Libraries
Multipeer Connectivity
14. Working with the Real World
Working with Location
Location Hardware
GPS
WiFi base station lookups
Cell tower lookups
iBeacons
The Core Location Framework
Working with Core Location
Geocoding
Region Monitoring and iBeacons
Locations and Privacy
Maps
Using Maps
Annotating Maps
Maps and Overlays
Device Motion
Working with Core Motion
Printing Documents
Printing on OS X
Printing on iOS
Game Controllers
App Nap
15. Event Kit
Understanding Events
Accessing the Event Store
Accessing Calendars
Accessing Events
Working with Events
Building an Events Application
User Privacy
16. Instruments and the Debugger
Getting Started with Instruments
The Instruments Interface
Observing Data
Adding Instruments from the Library
Fixing Problems with Instruments
Retain Cycles and Leaks
Using the Debugger
Setting Breakpoints
Controlling program flow
Custom breakpoints
Special breakpoints
Inspecting Memory Contents
Working with the Debugger Console
17. Sharing and Notifications
Sharing
Sharing on iOS
Sharing on OS X
Notifications
Push Notifications
What happens when a push arrives
Sending Push Notifications
Setting Up to Receive Push Notifications
Receiving Push Notifications
Local Notifications
18. Nonstandard Apps
Command-Line Tools
Preference Panes
How Preference Panes Work
Preference Domains
Building a Sample Preference Pane
Status Bar Items
Building a Status Bar App
iOS Apps with Multiple Windows
19. Working with Text
Internationalization and Localization
Strings Files
Creating a Sample Localized Application
Formatting Data with NSFormatter
Detecting Data with NSDataDetector
TextKit
20. iCloud
What iCloud Stores
Setting Up for iCloud
Testing Whether iCloud Works
Storing Settings
iCloud Storage
Index
Colophon
Copyright
← Prev
Back
Next →
← Prev
Back
Next →