New

Long-Term Learning

Learn efficiently and remember over time.

Start Long-Term Learning

Get personalized study reminders at intervals optimized for better retention.
Track your progress on this set by creating a folder
Or add to an existing folder

Add this set to a folder

  • 1.Associative References

    Creating Associations
    Retrieving Associated Objects
    Breaking Associations
    Complete Example

    2.Fast Enumeration

    The for...in Syntax
    Adopting Fast Enumeration
    Using Fast Enumeration

    3.Enabling Static Behavior

    Default Dynamic Behavior
    Static Typing
    Type Checking
    Return and Parameter Types
    Static Typing to an Inherited Class

    4.Selectors

    Methods and Selectors
    Varying the Message at Runtime
    The Target-Action Design Pattern
    Avoiding Messaging Errors

    5.Methods and Selectors

    SEL and @selector
    Methods and Selectors
    Method Return and Parameter Types

    6.Exception Handling

    Enabling Exception-Handling
    Exception Handling
    Catching Different Types of Exception
    Throwing Exceptions

    7.The Runtime System

    The Objective-C language defers as many decisions as it can from compile time and link time to runtime. Whenever possible, it dynamically performs operations such as creating objects and determining what method to invoke. Therefore, the language requires not just a compiler, but also a runtime system to execute the compiled code. The runtime system acts as a kind of operating system for the Objective-C language; it's what makes the language work. Typically, however, you don't need to interact with the runtime directly. To understand more about the functionality it offers, though, see Objective-C Runtime Programming Guide.

    8. Objects

    As the name implies, object-oriented programs are built around objects. An object associates data with the particular operations that can use or affect that data. Objective-C provides a data type to identify an object variable without specifying a particular class of the object.

    9.Object Basics

    An object associates data with the particular operations that can use or affect that data. In Objective-C, these operations are known as the object's methods; the data they affect are its instance variables (in other environments they may be referred to as ivars or member variables). In essence, an object bundles a data
    structure (instance variables) and a group of procedures (methods) into a self-contained programming unit.
    In Objective-C, an object's instance variables are internal to the object; generally, you get access to an object's state only through the object's methods (you can specify whether subclasses or other objects can access instance variables directly by using scope directives, see "The Scope of Instance Variables" (page 36)). For others to find out something about an object, there has to be a method to supply the information. For example, a rectangle would have methods that reveal its size and position.
    Moreover, an object sees only the methods that were designed for it; it can't mistakenly perform methods intended for other types of objects. Just as a C function protects its local variables, hiding them from the rest of the program, an object hides both its instance variables and its method implementations.

    10. id

    In Objective-C, object identifiers are of a distinct data type: id. This type is the general type for any kind of object regardless of class and can be used for instances of a class and for class objects themselves.
    id anObject;
    For the object-oriented constructs of Objective-C, such as method return values, id replaces int as the default data type. (For strictly C constructs, such as function return values, int remains the default type.)
    The keyword nil is defined as a null object, an id with a value of 0. id, nil, and the other basic types of Objective-C are defined in the header file objc/objc.h.
    id is defined as pointer to an object data structure:
    typedef struct objc_object {
    Class isa;
    } *id;
    Every object thus has an isa variable that tells it of what class it is an instance. Since the Class type is itself defined as a pointer:
    typedef struct objc_class *Class;
    the isa variable is frequently referred to as the "isa pointer."

    Please allow access to your computer’s microphone to use Voice Recording.

    Having trouble? Click here for help.

    We can’t access your microphone!

    Click the icon above to update your browser permissions above and try again

    Example:

    Reload the page to try again!

    Reload

    Press Cmd-0 to reset your zoom

    Press Ctrl-0 to reset your zoom

    It looks like your browser might be zoomed in or out. Your browser needs to be zoomed to a normal size to record audio.

    Please upgrade Flash or install Chrome
    to use Voice Recording.

    For more help, see our troubleshooting page.

    Your microphone is muted

    For help fixing this issue, see this FAQ.

    Star this term

    You can study starred terms together

    NEW! Voice Recording

    This is a Plus feature