You are previewing Cocoa and Objective-C Cookbook.
O'Reilly logo
Cocoa and Objective-C Cookbook

Book Description

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

  • 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

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

    Table of Contents

    1. Cocoa and Objective-C Cookbook
      1. Cocoa and Objective-C Cookbook
      2. Credits
      3. About the Author
      4. About the Reviewers
      5. www.PacktPub.com
            1. Support files, eBooks, discount offers and more
              1. Why subscribe?
              2. Free access for Packt account holders
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
        7. Errata
        8. Piracy
        9. Questions
      7. 1. User Interface Components
        1. Introduction
        2. Using a NSTableView
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Using a NSOutlineView
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Using NSSplitView
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Using the WebView
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Displaying a NSAlert
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Formatting dates
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
          5. See also
        8. Formatting numbers
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Importing images
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Saving preferences with NSUserDefaults
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        11. Retrieving preferences with NSUserDefaults
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        12. Adding a password to KeyChain
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        13. Retrieving a password from KeyChain
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        14. Accessing the Address Book
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        15. Adding an event to iCal
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      8. 2. Custom Views
        1. Introduction
        2. Drawing in your custom view
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Using your custom view in Interface Builder
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Handling mouse events in your view
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Handling keyboard events in your view
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Drawing strings with attributes
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      9. 3. Handling Events
        1. Introduction
        2. Interpreting the pinch gesture
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Interpreting the swipe gesture
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Interpreting the rotate gesture
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Handling special keys
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Working with NSResponder
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Application-wide notifications with NotificationCenter
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      10. 4. Using Animation
        1. Introduction
        2. Understanding the CALayer class
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Animation by changing properties
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Using animation to swap views
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Using the flip animation
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Using a CAAnimationGroup
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Using Keyframe animations
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Using CAMediaTiming in animations
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      11. 5. Objective-C 2.0
        1. Introduction
        2. Using blocks
          1. Getting ready
          2. How to do it…
          3. How it works...
          4. There's more...
          5. See also
        3. Switching compilers
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Create your own framework
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Using garbage collection
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Fast enumeration
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Declared properties
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      12. 6. Application Architecture
        1. Introduction
        2. The Singleton design pattern
          1. Getting ready
          2. How to do it…
          3. How it works...
          4. See also
        3. The Factory design pattern
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Using delegation in your own classes
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Using an NSTimer for periodic events
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Working with Key-Value Coding
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Using operators with Key Value Paths
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Using NSAutoreleasePool
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      13. 7. Better Debugging
        1. Introduction
        2. Using special environment variables
          1. Getting ready
          2. How to do it...
          3. How it works...
                  1. Environment Variables:
                  2. Preferences:
          4. There's more...
          5. See also
        3. Using Instruments for performance
          1. Getting ready
          2. How to do it...
          3. How it works
          4. There's more...
          5. See also
        4. Handling exceptions
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Knowing when you are being debugged
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Using Debugger() and DebugStr()
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Using Build and Analyze in Xcode
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      14. 8. System Integration
        1. Introduction
        2. Adding a Badge to your Dock icon
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Adding a Menu to your Dock icon
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Creating a disk image for your application
          1. Getting ready
          2. How to do it...
          3. How it works…
          4. There's more...
          5. See also
        5. Updating your application With Sparkle
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      15. 9. Working with Files
        1. Introduction
        2. Saving your class with NSKeyedArchiver
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Loading your class with NSKeyedUnarchiver
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Finding special folders
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Basic XML parsing
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Parsing JSON
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      16. 10. Working with the Web
        1. Introduction
        2. Using NSURLConnection with HTTP GET
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Using NSURLConnection with HTTP POST
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Adding a hex encoding category to NSData
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Adding a hex decoding category to NSString
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Adding a Base64 encoding category to NSData
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Adding a Base64 decoding category to NSString
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        8. Adding a MD5 hash category to NSData
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Escaping a URL
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      17. 11. Working with Databases
        1. Introduction
        2. Inserting a row with MySQL
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Using prepared statements with MySQL
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Selecting data using MySQL
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Inserting a row with SQLite
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Using prepared statements with SQLite
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Selecting rows using SQLite
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
      18. 12. Multimedia
        1. Introduction
        2. Playing movies with QuickTime
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Playing an audio file
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Using a Core Image filter
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Getting EXIF information from an image
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also