Cocoa® Programming for Mac OS® X For Dummies®

Book description

Cocoa programming is not only the favored development environment for Mac OS X, it’s also a primary tool for creating iPhone and iPod Touch software. That makes this a great time to learn Cocoa, and Cocoa Programming for Mac OS X For Dummies is the ideal place to start!

This book gives you a solid foundation in Cocoa and the unusual syntax of Objective-C. You’ll learn what’s new in Cocoa frameworks and create an application step by step. For example, you can:

  • See how Xcode underlies your applications as the main component of Apple’s IDE

  • Examine the basics of the Objective-C language, the elements of a Cocoa interface, and object-oriented programming

  • Use Xcode and Interface Builder

  • Spruce up your apps with audio, video, Internet features, stylized text, and more

  • Create applications with the stunning graphics for which Macs are famous

  • See how to build apps with multiple documents and even executables that aren’t traditional Mac apps

  • Use all the exciting new Cocoa features

  • Work with Cocoa numbers, arrays, Booleans, and dates

  • Build document-based applications

  • Simplify with key-value coding

The better you understand Cocoa programming, the better the applications you can create for Mac OS X, iPhone, and iPod Touch. Cocoa Programming for Mac OS X For Dummies makes it easy and fun!

Table of contents

  1. Copyright
  2. About the Author
  3. Author's Acknowledgments
  4. Publisher's Acknowledgments
  5. Introduction
    1. About This Book
    2. Conventions Used in This Book
    3. Foolish Assumptions
    4. How this Book Is Organized
      1. Part I: Developer Tools
      2. Part II: Instant Cocoa and the Objective-C Language
      3. Part III: Putting It All Together: Cocoa Programming in Depth
      4. Part IV: Advanced Cocoa Topics
      5. Part V: The Part of Tens
    5. Icons Used in This Book
    6. Where to Go From Here
  6. I. Developer Tools
    1. 1. A Brief Tour of Cocoa Development
      1. 1.1. Mac OS X Is a Programmer's Dream
      2. 1.2. Why Program with Cocoa?
      3. 1.3. The Tools You Need
        1. 1.3.1. Xcode
        2. 1.3.2. Interface Builder
    2. 2. Creating Your First Cocoa Application
      1. 2.1. Creating a Cocoa Application in Six Simple Steps
      2. 2.2. Beginning a Project
        1. 2.2.1. Thinking of an idea
        2. 2.2.2. Getting started with your Cocoa project
      3. 2.3. Building an Interface
        1. 2.3.1. Adding controls to the interface
        2. 2.3.2. Wiring the interface
          1. 2.3.2.1. Creating classes
          2. 2.3.2.2. Adding outlets
          3. 2.3.2.3. Adding an action
          4. 2.3.2.4. Adding the class to the interface
        3. 2.3.3. Making connections
      4. 2.4. Adding Code to Make Your App Work
      5. 2.5. Debugging and Building the Application
    3. 3. Xcode
      1. 3.1. Xcode: The Core of Apple's Development Tools
      2. 3.2. Customizing Xcode Preferences
      3. 3.3. Working with Project Files
        1. 3.3.1. Class models
        2. 3.3.2. File comments
        3. 3.3.3. Using favorites to speed up development
      4. 3.4. Debugging Your Project
        1. 3.4.1. Adding breakpoints
        2. 3.4.2. Stepping through the debugger
        3. 3.4.3. Fixing the code
        4. 3.4.4. Removing breakpoints
      5. 3.5. Where to Go for Help
      6. 3.6. Building an Application
    4. 4. Interface Builder
      1. 4.1. A Tour of Interface Builder
        1. 4.1.1. The interface builder project window
        2. 4.1.2. Design window
        3. 4.1.3. Library window
        4. 4.1.4. Inspector window
        5. 4.1.5. Menu editor window
      2. 4.2. The Interface Building Process
        1. 4.2.1. Adding a pop-up menu
        2. 4.2.2. Adding a menu
        3. 4.2.3. Creating a Controller class
        4. 4.2.4. Connecting the interface
      3. 4.3. Using an Interface in Xcode
    5. 5. Putting Polishing Touches on Your Application
      1. 5.1. Adding an About Panel
        1. 5.1.1. Setting an icon
        2. 5.1.2. Setting the name or title
        3. 5.1.3. Displaying a version number, a copyright date, and credits
      2. 5.2. Assigning an Icon to Your Project
        1. 5.2.1. Icon Composer
        2. 5.2.2. Managing your icons
      3. 5.3. Creating a Disk Image for Distribution
  7. II. Instant Cocoa and the Objective-C Language
    1. 6. The Basics of Objective-C
      1. 6.1. Why Use Object-Oriented Programming?
      2. 6.2. Class Is No Object!
        1. 6.2.1. Declaring instance variables
        2. 6.2.2. Declaring methods
        3. 6.2.3. Defining methods in an interface file
      3. 6.3. Coding in Objective-C
        1. 6.3.1. Sending messages to objects
        2. 6.3.2. Passing parameters
        3. 6.3.3. Returning values
        4. 6.3.4. Instantiating an object
        5. 6.3.5. Managing memory
      4. 6.4. Working with Your Own Classes
        1. 6.4.1. Defining the class
        2. 6.4.2. Implementing the class
        3. 6.4.3. Using the class
        4. 6.4.4. Testing
    2. 7. MVC Design
      1. 7.1. Taking a Look at MVC Design
      2. 7.2. Building a Project with an MVC Design
        1. 7.2.1. Adding a View
        2. 7.2.2. Adding a Controller
    3. 8. A Window with a View
      1. 8.1. Working with Windows
        1. 8.1.1. Opening and closing a window
        2. 8.1.2. Hiding and showing a window
        3. 8.1.3. Positioning windows
        4. 8.1.4. Keeping track of windows
        5. 8.1.5. Putting windows to work for you
      2. 8.2. Changing the Appearance of Windows
        1. 8.2.1. Using different windows for different tasks
        2. 8.2.2. Sizing up your windows
        3. 8.2.3. Setting a window's title
        4. 8.2.4. Windows that you can see through
      3. 8.3. Beneath the Sheets
      4. 8.4. Responding to Window Events by Delegating Authority
    4. 9. Working with Interface Controls
      1. 9.1. Button Controls
        1. 9.1.1. Push button
        2. 9.1.2. Round button
        3. 9.1.3. Check box
        4. 9.1.4. Square and rounded bevel buttons
      2. 9.2. Radio Control
      3. 9.3. Slider Control
      4. 9.4. Tab Views
      5. 9.5. Making Progress at the Bar
      6. 9.6. Table Control
    5. 10. Cocoa Data Types
      1. 10.1. Working with Numbers
      2. 10.2. Working with Arrays
        1. 10.2.1. NSArray
        2. 10.2.2. NSMutableArray
      3. 10.3. Working with Boolean Data Types
      4. 10.4. Working with Dates
  8. III. Putting It All Together: Cocoa Programming in Depth
    1. 11. Text
      1. 11.1. Working with Text
        1. 11.1.1. Building an interface
        2. 11.1.2. Adding a controller class
        3. 11.1.3. Wiring the interface
        4. 11.1.4. Adding the code
      2. 11.2. Doing Style the Easy Way!
      3. 11.3. Manipulating Text
        1. 11.3.1. Pasteboard manipulations
        2. 11.3.2. Manual editing
      4. 11.4. Saving Text for a Rainy Day
      5. 11.5. Retrieving Text
    2. 12. Graphics
      1. 12.1. Cocoa and the Art of Graphics
        1. 12.1.1. Points
        2. 12.1.2. Rects and sizes
        3. 12.1.3. Colors
          1. 12.1.3.1. Using convenience colors
          2. 12.1.3.2. Using device-dependent color spaces
      2. 12.2. Building a Graphics Interface
      3. 12.3. Painting with Lines and Shapes
        1. 12.3.1. Starting with Beziér paths
        2. 12.3.2. Filling a path
        3. 12.3.3. Drawing a path
        4. 12.3.4. Creating fancy-pants paths
      4. 12.4. Drawing Text
      5. 12.5. Displaying an Image
    3. 13. Managing Your Files
      1. 13.1. About Files and Folders in Mac OS X
      2. 13.2. Opening and Using Files
        1. 13.2.1. Building the interface
        2. 13.2.2. Creating a Controller class
        3. 13.2.3. Open sesame ...er, panel
        4. 13.2.4. Finding a file's path, name, and more
        5. 13.2.5. Viewing a file's icon
        6. 13.2.6. Reading from and writing to documents
      3. 13.3. Working with Files and Folders
        1. 13.3.1. Copying files and folders
        2. 13.3.2. Moving files and folders
        3. 13.3.3. Deleting files and folders
        4. 13.3.4. Creating folders
    4. 14. Printing with Cocoa
      1. 14.1. How Printing Works in Cocoa
      2. 14.2. Tweaking the Page Settings
      3. 14.3. Setting Up the Print Job and Printing the View
      4. 14.4. Printing to Places Other Than a Printer
    5. 15. Cocoa on the Internet
      1. 15.1. Interacting with the Web
        1. 15.1.1. Loading a Web page in a browser
        2. 15.1.2. Downloading files
        3. 15.1.3. Building a Web browser
      2. 15.2. Sending E-Mail from a Cocoa Application
        1. 15.2.1. Sending e-mail from your favorite client
        2. 15.2.2. Sending e-mail from your own apps
        3. 15.2.3. Adding e-mail functions to the project
    6. 16. Multimedia
      1. 16.1. Listening to Audio
        1. 16.1.1. Playing system sounds
        2. 16.1.2. Loading and playing sound files
        3. 16.1.3. Building a simple audio player
          1. 16.1.3.1. Adding stop functionality
          2. 16.1.3.2. Connecting the actions to the interface
      2. 16.2. Watching Movies with Cocoa
        1. 16.2.1. QTMovie
        2. 16.2.2. QTMovieView
        3. 16.2.3. Building a simple movie player
        4. 16.2.4. When a movie isn't a movie
  9. IV. Advanced Cocoa Topics
    1. 17. Document-Based Applications
      1. 17.1. Creating a Document-Based Project
      2. 17.2. Building the Interface for a Document-Based Project
      3. 17.3. Adding the Code
    2. 18. Cocoa Bindings
      1. 18.1. What Are Bindings?
      2. 18.2. Starting a Project with Bindings
      3. 18.3. Making Your Bindings Work: KVC and KVO
      4. 18.4. Implementing Bindings
    3. 19. Core Data
      1. 19.1. What's So Great about Core Data Anyway?
      2. 19.2. Creating a Core Data Project
      3. 19.3. Defining the Model
      4. 19.4. Building the Interface
  10. V. The Part of Tens
    1. 20. Ten Tips to Make Cocoa Programming Easier
      1. 20.1. Use Keyboard Shortcuts
      2. 20.2. Read the Documentation
      3. 20.3. Use Class Browser
      4. 20.4. Adjust the Window Count
      5. 20.5. Use Drag and Drop
      6. 20.6. Initialize and Awaken!
      7. 20.7. Remember the Superclass
      8. 20.8. Position Items with Cocoa Coordinates
      9. 20.9. Use Guidelines in Interface Builder
      10. 20.10. Reuse Your Code
    2. 21. Ten Great Web Sites for Cocoa Developers
      1. 21.1. Apple Developer Connection
      2. 21.2. Borkware Quickies
      3. 21.3. Cocoa Is My Girlfriend
      4. 21.4. Theocacao
      5. 21.5. Call Me Fishmeal
      6. 21.6. Domain of the Bored
      7. 21.7. Dan Wood: The Eponymous Weblog
      8. 21.8. Apple Forums
      9. 21.9. Cocoa Dev Central
      10. 21.10. CocoaDev

Product information

  • Title: Cocoa® Programming for Mac OS® X For Dummies®
  • Author(s):
  • Release date: February 2009
  • Publisher(s): For Dummies
  • ISBN: 9780470432891