Same textField from two different classes

Discussion in 'Mac Programming' started by Streamer, May 1, 2008.

  1. Streamer macrumors member

    Apr 18, 2008
    Apols for a noobie question. I have a textfield and it is connected as an outlet to one class, however I sometimes want to write to it from another class. I ended up declaring an outlet in the new class and connecting that, so I have the same object as two outlets. Is that ok or am I heading to a bigger problem.

  2. HiRez macrumors 603


    Jan 6, 2004
    Western US
    You can reference it from as many classes as you like. Another way would be to have a controller object that has sole direct access to it and then access it from other classes through the controller, like [[myController testTextField] setStringValue:mad:"TEST"];
  3. Streamer thread starter macrumors member

    Apr 18, 2008
    Many thanks for the answer. I did originally try the latter way but I think I screwed up my bracket ordering :cool:

    Much appreciated.

Share This Page