Cocoa and Objective-C Cookbook

Cocoa and Objective-C Cookbook
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • 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

Book Details

Language : English
Paperback : 248 pages [ 235mm x 191mm ]
Release Date : May 2011
ISBN : 1849690383
ISBN 13 : 9781849690386
Author(s) : Jeff Hawkins
Topics and Technologies : All Books, Game Development, Cookbooks

Table of Contents

Chapter 1: User Interface Components
Chapter 2: Custom Views
Chapter 3: Handling Events
Chapter 4: Using Animation
Chapter 5: Objective-C 2.0
Chapter 6: Application Architecture
Chapter 7: Better Debugging
Chapter 8: System Integration
Chapter 9: Working with Files
Chapter 10: Working with the Web
Chapter 11: Working with Databases
Chapter 12: Multimedia
  • 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

                          Jeff Hawkins

                          Jeff Hawkins has been developing software solutions and applications for 19 years. He has worked for Adobe Systems supporting third-party developers writing plug-ins for FrameMaker on the Macintosh, Windows, and Solaris platforms. He also has worked for a startup delivering prime-time television shows via satellite to television stations across the United States. Jeff currently works in the Tools and Architecture group for ADP Inc. designing and coding solutions for enterprise payroll systems. Jeff has extensive experience working with C, C++, Objective-C, Java, and JavaScript. In his spare time, Jeff enjoys working with Apple's iOS developing mobile applications and games. Jeff is also a private pilot with a seaplane rating and has built and flown his own Van's RV-8 airplane.

                          Code Downloads

                          Download the code and support files for this book.

                          Submit Errata

                          Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

                          Sample chapters

                          You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                          Frequently bought together

                          Cocoa and Objective-C Cookbook +    Yii 1.1 Application Development Cookbook =
                          50% Off
                          the second eBook
                          Price for both: $34.95

                          Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                          What you will learn from this book

                          • 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.


                          Written in a cookbook style, this book offers solutions using a recipe-based approach. Each recipe contains step-by-step instructions followed by an analysis of what was done in each task and other useful information. The cookbook approach means you can dive into whatever recipes you want in no particular order.

                          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.

                          Code Download and Errata
                          Packt Anytime, Anywhere
                          Register Books
                          Print Upgrades
                          eBook Downloads
                          Video Support
                          Contact Us
                          Awards Voting Nominations Previous Winners
                          Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                          Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software