Cover image for Objective-C Pocket Reference

Book description

Objective-C is an exciting and dynamic approach to C-based object-oriented programming; it's the approach adopted by Apple as the foundation for programming under Mac OS X, a Unix-based operating system gaining wide acceptance among programmers and other technologists. Objective-C is easy to learn and has a simple elegance that is a welcome breath of fresh air after the abstruse and confusing C++. To help you master the fundamentals of this language, you'll want to keep the Objective-C Pocket Reference close at hand. This small book contains a wealth of valuable information to speed you over the learning curve. In this pocket reference, author Andrew Duncan provides a quick and concise introduction to Objective-C for the experienced programmer. In addition to covering the essentials of Objective-C syntax, Andrew also covers important faces of the language such as memory management, the Objective-C runtime, dynamic loading, distributed objects, and exception handling. O'Reilly's Pocket References have become a favorite among programmers everywhere. By providing important details in a succinct, well-organized format, these handy books deliver just what you need to complete the task at hand. When you've reached a sticking point in your work and need to get to a solution quickly, the new Objective-C Pocket Reference is the book you'll want to have.

Table of Contents

  1. Objective-C Pocket Reference
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. 1. Objective-C Pocket Reference
      1. 1.1. Introduction
        1. 1.1.1. Typographic Conventions
        2. 1.1.2. Acknowledgments
      2. 1.2. What Is Objective-C?
        1. 1.2.1. Dynamic Dispatch
        2. 1.2.2. Dynamic Typing
        3. 1.2.3. Dynamic Loading
        4. 1.2.4. Which Objective-C?
        5. 1.2.5. How Do I Get Started?
      3. 1.3. Elements of the Language
        1. 1.3.1. Objects
        2. 1.3.2. Classes
          1. 1.3.2.1. Declaring an interface
          2. 1.3.2.2. Implementing a class
        3. 1.3.3. Inheritance and Subtyping
        4. 1.3.4. Fields
          1. 1.3.4.1. Access modifiers
        5. 1.3.5. Methods
          1. 1.3.5.1. Declaring a method
            1. 1.3.5.1.1. No parameters
            2. 1.3.5.1.2. One parameter
            3. 1.3.5.1.3. More than one parameter
            4. 1.3.5.1.4. A variable number of parameters
          2. 1.3.5.2. Implementing a method
          3. 1.3.5.3. Calling a method
          4. 1.3.5.4. Naming collisions
          5. 1.3.5.5. Private methods
          6. 1.3.5.6. Accessors
          7. 1.3.5.7. Message search paths
          8. 1.3.5.8. Special receivers
          9. 1.3.5.9. Selectors
        6. 1.3.6. Categories
          1. 1.3.6.1. Declaring a category
          2. 1.3.6.2. Implementing a category
        7. 1.3.7. Protocols
          1. 1.3.7.1. Declaring a protocol
          2. 1.3.7.2. Adopting a protocol
          3. 1.3.7.3. Checking for conformity to a protocol
          4. 1.3.7.4. Informal protocols
        8. 1.3.8. Declarations
          1. 1.3.8.1. Dynamic typing
          2. 1.3.8.2. Static typing
          3. 1.3.8.3. Type qualifiers
        9. 1.3.9. Predefined Types, Constants, and Variables
          1. 1.3.9.1. Types
          2. 1.3.9.2. Constants
          3. 1.3.9.3. Variables
      4. 1.4. Compiler and Preprocessor Directives
        1. 1.4.1. Class Declarations and Definitions
        2. 1.4.2. Forward Declarations
        3. 1.4.3. Expanding Directives
          1. 1.4.3.1. Using @encode
          2. 1.4.3.2. Using @defs
          3. 1.4.3.3. Using @"string"
        4. 1.4.4. Preprocessor Symbols
      5. 1.5. Compiler Flags
      6. 1.6. Remote Messaging
        1. 1.6.1. Pointer Parameter Qualifiers
        2. 1.6.2. Return Value Qualifiers
        3. 1.6.3. Object Qualifiers
      7. 1.7. Object Lifecycle
        1. 1.7.1. Creating an Object
          1. 1.7.1.1. Calling creation methods
          2. 1.7.1.2. Writing creation methods
          3. 1.7.1.3. Sample code for initialization
          4. 1.7.1.4. Initializing classes
        2. 1.7.2. Copying an Object
          1. 1.7.2.1. Calling copy methods
          2. 1.7.2.2. Writing copy methods
        3. 1.7.3. Deallocating an Object
          1. 1.7.3.1. Calling deallocation methods
          2. 1.7.3.2. Writing deallocation methods
      8. 1.8. Runtime Errors
        1. 1.8.1. Object Error Handling
        2. 1.8.2. Exceptions in Cocoa
          1. 1.8.2.1. Keywords for handling exceptions
          2. 1.8.2.2. A Cocoa exception handling example
      9. 1.9. Runtime Environment
        1. 1.9.1. Class Objects
        2. 1.9.2. Metaclass Objects
        3. 1.9.3. Selectors
        4. 1.9.4. Protocol Objects
      10. 1.10. Root Classes
        1. 1.10.1. Fields
        2. 1.10.2. Methods
        3. 1.10.3. The Object Class
          1. 1.10.3.1. Creating, copying, and freeing objects
          2. 1.10.3.2. Identifying objects and classes
          3. 1.10.3.3. Testing object type
          4. 1.10.3.4. Testing inheritance and conformance
          5. 1.10.3.5. Information about methods
          6. 1.10.3.6. Sending messages
          7. 1.10.3.7. Posing
          8. 1.10.3.8. Enforcing intentions
          9. 1.10.3.9. Error handling
          10. 1.10.3.10. Archiving
        4. 1.10.4. The NSObject Class
          1. 1.10.4.1. Creating, copying, and freeing objects
          2. 1.10.4.2. Identifying objects and classes
          3. 1.10.4.3. Testing inheritance and conformance
          4. 1.10.4.4. Information about methods
          5. 1.10.4.5. Sending messages
          6. 1.10.4.6. Posing
          7. 1.10.4.7. Error handling
          8. 1.10.4.8. Archiving
          9. 1.10.4.9. Reference counting
      11. 1.11. Forwarding Messages
        1. 1.11.1. Object Forwarding
        2. 1.11.2. NSObject Forwarding
      12. 1.12. Memory Management
        1. 1.12.1. Manual Memory Management
        2. 1.12.2. Reference Counting
          1. 1.12.2.1. Maintaining an object's reference count
          2. 1.12.2.2. Creating a new object
          3. 1.12.2.3. Receiving an object from another scope
          4. 1.12.2.4. Returning an already-stored object
          5. 1.12.2.5. Replacing an already-stored object
          6. 1.12.2.6. Deallocating an object
          7. 1.12.2.7. Retain cycles
        3. 1.12.3. Garbage Collection
      13. 1.13. Archiving Objects
        1. 1.13.1. Archiving Descendants of Object
        2. 1.13.2. Archiving Descendants of NSObject
      14. 1.14. Key-Value Coding
        1. 1.14.1. Access Permissions
        2. 1.14.2. NSKeyValueCoding Methods
        3. 1.14.3. Handling Key Lookup Failures
      15. 1.15. Optimizing Method Calls
      16. 1.16. Objective-C++
      17. 1.17. Objective-C Resources
    3. Index
    4. SPECIAL OFFER: Upgrade this ebook with O’Reilly