Re: compiler error related to 'save' method of NSUserDefaultsController

  • I see. This particular method is most often associated with a commit/
    revert scenario with defaults - as in a panel for defaults and an
    associated pair of action buttons.

    Thanks very much for your clear explanation. Perhaps if I hang around
    here long enough, I "might" gain the equivalent of a week at the Big
    Nerd Ranch ;-)

    Chris

    On Nov 11, 2007, at 8:15 PM, Chris Campbell wrote:

    > On Nov 11, 2007, at 8:03 PM, Chris Heimark wrote:
    >
    >> That still doesn't tell me why Apple chose to have an ID returned
    >> rather than the standard convention. Is this just an aberration or
    >> is there a specific reason why in this case they chose to return
    >> an ID?
    >
    > The "convention" in this case is an action method that can be
    > configured in Interface Builder (set as the target and action for
    > buttons, menu items, etc). So the method would need to be declared as:
    >
    > - (IBAction)save:(id)sender;
    >
    > which is equivalent to:
    >
    > - (void)save:(id)sender;
    >
    > Whenever you see a single "(id)sender" argument, think: "Oh, it's
    > so I can invoke this method by hooking up a target/action in
    > Interface Builder by control-dragging to this receiver object in
    > the nib file."
    >
    > It does make the API a bit odd for invoking the methods
    > programatically, though. There's always the question of what the
    > appropriate value for "sender" should be. (Personally, I always use
    > "nil" because most action methods either don't use the sender
    > argument at all, or they expect it to be a button or menu item,
    > which my custom objects certainly aren't.)
    >
    > - Chris
    >
    >
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today