(id)init as constructor or how to init values?

Discussion in 'Mac Programming' started by Sergio10, Mar 30, 2009.

  1. macrumors regular

    Joined:
    Oct 3, 2007
    #1
    Hi all,

    I need to init position value. This value uses by edit box control via NSObject controller. So I wrote:
    - (id) init
    {
    [position setStringValue: @"My value"];
    return self;
    }

    But it don't works :) Why "position" don't initializes? How to solve this problem?

    Thanks,
    Sergio
     
  2. macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #2
  3. thread starter macrumors regular

    Joined:
    Oct 3, 2007
    #3
    Thanks for answering. It's work now.
    If -(void)awakeFromNib responsible for outlets, value initializing, so why we should to use -(id)init function?
     
  4. macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #4
    Most objects are not created from nibs, so -awakeFromNib: is never called on them.
     

Share This Page