Cocoa and Objective-C Cookbook

Move beyond basic Cocoa development using over 70 simple and effective recipes for Mac OS X development

Cocoa and Objective-C Cookbook

Cookbook
Jeff Hawkins

Move beyond basic Cocoa development using over 70 simple and effective recipes for Mac OS X development
$23.99
$39.99
RRP $23.99
RRP $39.99
eBook
Print + eBook
$12.99 p/month

Want this title & more? Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.
+ Collection
Free Sample

Book Details

ISBN 139781849690386
Paperback248 pages

About This Book

  • Develop Cocoa applications using advanced UI concepts
  • Implement the latest Objective-C features and incorporate them into your applications
  • Debug Cocoa applications using advanced tools and techniques
  • Add advanced animation and multimedia to your Cocoa applications

Who This Book Is For

This book is perfect for the Mac OS X Cocoa developer who is ready to move beyond the basics and dive into more advanced Cocoa topics. The cookbook format lets you jump right into the examples without the lengthy explanations you often find in other books. Basic familiarity with Cocoa and Objective-C development is required.

Table of Contents

Chapter 1: User Interface Components
Introduction
Using a NSTableView
Using a NSOutlineView
Using NSSplitView
Using the WebView
Displaying a NSAlert
Formatting dates
Formatting numbers
Importing images
Saving preferences with NSUserDefaults
Retrieving preferences with NSUserDefaults
Adding a password to KeyChain
Retrieving a password from KeyChain
Accessing the Address Book
Adding an event to iCal
Chapter 2: Custom Views
Introduction
Drawing in your custom view
Using your custom view in Interface Builder
Handling mouse events in your view
Handling keyboard events in your view
Drawing strings with attributes
Chapter 3: Handling Events
Introduction
Interpreting the pinch gesture
Interpreting the swipe gesture
Interpreting the rotate gesture
Handling special keys
Working with NSResponder
Application-wide notifications with NotificationCenter
Chapter 4: Using Animation
Introduction
Understanding the CALayer class
Animation by changing properties
Using animation to swap views
Using the flip animation
Using a CAAnimationGroup
Using Keyframe animations
Using CAMediaTiming in animations
Chapter 5: Objective-C 2.0
Introduction
Using blocks
Switching compilers
Create your own framework
Using garbage collection
Fast enumeration
Declared properties
Chapter 6: Application Architecture
Introduction
The Singleton design pattern
The Factory design pattern
Using delegation in your own classes
Using an NSTimer for periodic events
Working with Key-Value Coding
Using operators with Key Value Paths
Using NSAutoreleasePool
Chapter 7: Better Debugging
Introduction
Using special environment variables
Using Instruments for performance
Handling exceptions
Knowing when you are being debugged
Using Debugger() and DebugStr()
Using Build and Analyze in Xcode
Chapter 8: System Integration
Introduction
Adding a Badge to your Dock icon
Adding a Menu to your Dock icon
Creating a disk image for your application
Updating your application With Sparkle
Chapter 9: Working with Files
Introduction
Saving your class with NSKeyedArchiver
Loading your class with NSKeyedUnarchiver
Finding special folders
Basic XML parsing
Parsing JSON
Chapter 10: Working with the Web
Introduction
Using NSURLConnection with HTTP GET
Using NSURLConnection with HTTP POST
Adding a hex encoding category to NSData
Adding a hex decoding category to NSString
Adding a Base64 encoding category to NSData
Adding a Base64 decoding category to NSString
Adding a MD5 hash category to NSData
Escaping a URL
Chapter 11: Working with Databases
Introduction
Inserting a row with MySQL
Using prepared statements with MySQL
Selecting data using MySQL
Inserting a row with SQLite
Using prepared statements with SQLite
Selecting rows using SQLite
Chapter 12: Multimedia
Introduction
Playing movies with QuickTime
Playing an audio file
Using a Core Image filter
Getting EXIF information from an image

What You Will Learn

  • Use Core Animation to swap and flip views
  • Handle the pinch, swipe, and rotate gestures in your custom views
  • Safely store and retrieve passwords using the Keychain Access API
  • Understand the CA Layers to add smooth animations to your application's user interface
  • Add audio and QuickTime movies into your application
  • Incorporate MySQL and SQLite into your application to store and retrieve data
  • Use advanced debugging techniques and tools
  • Build the foundation of your application using basic UI components such as the table view, outline view, and web view

In Detail

Much of Cocoa is implemented in Objective-C, an object-oriented language that is designed to run at high speed. In order to build powerful Cocoa applications you need more than the basics. This cookbook will provide you with the recipes needed to add Core Animation, gestures, Key Value Coding, and QuickTime to your appilications.

The Cocoa and Objective-C Cookbook moves developers beyond the basics of developing with Apple's Cocoa framework. It will help you grasp advanced topics needed to build polished Cocoa applications on Mac OS X.

The cookbook provides a comprehensive overview of Cocoa's more popular UI components found in all Mac OS X applications. It has recipes for building custom views, adding support for gestures and working with keyboard and mouse events. There are recipes for using singleton, delegation, and factory design patterns in your own application's architecture. Alongside essential recipes for working with databases and debugging you will also find fun recipes covering animation and multimedia. The Cocoa and Objective-C Cookbook will quickly bring you up to speed with advanced technologies used to build complex applications for Mac OS X.

Authors

Table of Contents

Chapter 1: User Interface Components
Introduction
Using a NSTableView
Using a NSOutlineView
Using NSSplitView
Using the WebView
Displaying a NSAlert
Formatting dates
Formatting numbers
Importing images
Saving preferences with NSUserDefaults
Retrieving preferences with NSUserDefaults
Adding a password to KeyChain
Retrieving a password from KeyChain
Accessing the Address Book
Adding an event to iCal
Chapter 2: Custom Views
Introduction
Drawing in your custom view
Using your custom view in Interface Builder
Handling mouse events in your view
Handling keyboard events in your view
Drawing strings with attributes
Chapter 3: Handling Events
Introduction
Interpreting the pinch gesture
Interpreting the swipe gesture
Interpreting the rotate gesture
Handling special keys
Working with NSResponder
Application-wide notifications with NotificationCenter
Chapter 4: Using Animation
Introduction
Understanding the CALayer class
Animation by changing properties
Using animation to swap views
Using the flip animation
Using a CAAnimationGroup
Using Keyframe animations
Using CAMediaTiming in animations
Chapter 5: Objective-C 2.0
Introduction
Using blocks
Switching compilers
Create your own framework
Using garbage collection
Fast enumeration
Declared properties
Chapter 6: Application Architecture
Introduction
The Singleton design pattern
The Factory design pattern
Using delegation in your own classes
Using an NSTimer for periodic events
Working with Key-Value Coding
Using operators with Key Value Paths
Using NSAutoreleasePool
Chapter 7: Better Debugging
Introduction
Using special environment variables
Using Instruments for performance
Handling exceptions
Knowing when you are being debugged
Using Debugger() and DebugStr()
Using Build and Analyze in Xcode
Chapter 8: System Integration
Introduction
Adding a Badge to your Dock icon
Adding a Menu to your Dock icon
Creating a disk image for your application
Updating your application With Sparkle
Chapter 9: Working with Files
Introduction
Saving your class with NSKeyedArchiver
Loading your class with NSKeyedUnarchiver
Finding special folders
Basic XML parsing
Parsing JSON
Chapter 10: Working with the Web
Introduction
Using NSURLConnection with HTTP GET
Using NSURLConnection with HTTP POST
Adding a hex encoding category to NSData
Adding a hex decoding category to NSString
Adding a Base64 encoding category to NSData
Adding a Base64 decoding category to NSString
Adding a MD5 hash category to NSData
Escaping a URL
Chapter 11: Working with Databases
Introduction
Inserting a row with MySQL
Using prepared statements with MySQL
Selecting data using MySQL
Inserting a row with SQLite
Using prepared statements with SQLite
Selecting rows using SQLite
Chapter 12: Multimedia
Introduction
Playing movies with QuickTime
Playing an audio file
Using a Core Image filter
Getting EXIF information from an image

Book Details

ISBN 139781849690386
Paperback248 pages
Read More