Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In Hour 11, you learned how to add fields to the data model add new fields to the interface, and link them together. In this hour, you have revised a (or created a new) data model to contain additional fields for the Customer entity, so the first step is done.
Interface Builder Type Qualifiers and MacrosWhen you declare a property (or when you declare an instance variable), you can specify a type qualifier that Interface Builder editor can use. To indicate that a specific property (or variable) can be an outlet (that is, that it can be connected from a graphical element on a nib file’s canvas to a code construct in the corresponding file), you use the IBOutlet type qualifier. This is defined as blank, so it has absolutely no effect on the declaration (because, at compile time, it has disappeared). It is only used by Interface Builder editor. Beginning in iOS 4.0, a variation on IBOutlet has been introduced. You use it to make a connection to an NSArray or NSMutableArray object. You specify the type of object that will be placed in that collection so you might use it, as in this sample: @property (strong, nonatomic) IBOutletCollection(UIView) NSArray *views; IBOutletCollection is actually a macro rather than a type qualifier, but that should not matter to you. To be able to connect a declared action in the interface file to an interface element on the canvas (perhaps a button), you use the type qualified IBAction. IBAction is defined to void. This means that when you declare an action in your interface file, you write something like the following: - (IBAction)myAction:(id)sender; At compile time, that line is interpreted as follows: - (void)myAction:(id)sender; However, Interface Builder editor is able to recognize it as an action because Interface Builder editor is looking at your source code and not the compiled code. |