Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  Adding a Preferences Window to Your Application
Subject:   please refine my cocoa semantics
Date:   2001-09-22 19:02:30
From:   psheldon
Well , I have finished this column . It was a long time until I could try "letting the hammer fall" and compiling . Because of the extreme modularity of the code , I rapidly got through my typos and omissions . That was an experience ! Hey , I have learned wisdom here !


Item 1 :
p.5 wrote - (void)setColumn:(id)sender;
should it not instead read , as it did p.16
- (IBAction)setColumn:(id)sender;
is there a difference ?


Item 2 :
p.16
NSTableColumn *column = [tableColumns objectForKey:identifier];
Does this really mean :
(NSTableColumn *) column = [tableColumns objectForKey:identifier];
* is not actually an operator to right on column (acting before assignment) ,
it actually acts to the left on NSTableColumn to make that a pointer to NSTableColumn
(acting again before assignment)
and the assignment is then pass by reference :
column = [tableColumns objectForKey:identifier];


Item 3 :
In addition, is the first entity of any [], that is "a" of [a b], always a pointer ?


Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • Michael Beam photo please refine my cocoa semantics
    2001-09-25 20:00:52  Michael Beam | O'Reilly Author [View]

    Item 1:

    IBAction is actually the same as void, so they're _somewhat_ interchangeable, although in my case it was a slip up in this monster of a column. IBAction as a data type is actually used so that Interface Builder can parse headers that you create. That is, if you create a class header that contains all of your outlets and actions, you can drop that into you nib file window in IB, and IB will create a new class based on your header with all of the appropriate outlets and actions. It knows which items are outlets and which are actions by the IBAction and IBOutlet "tags"

    Item 2:

    Yes, the * is part of the data type, not the variable name. It indicates that the variable is a pointer to whatever type of object is indicated.

    Item 3:
    and yes, as far as i know and in my experience, "a" is always a pointer since that i how we work with objects in Objective-C. If anyone know a case where this is not true, please share it with us!

    Hope that helps!

    Mike
    • please refine my cocoa semantics
      2001-09-26 14:08:16  psheldon [View]

      Thanks.
      • Michael Beam photo please refine my cocoa semantics
        2001-09-27 07:50:56  Michael Beam | O'Reilly Author [View]

        You're welcome