Same textField from two different classes

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

  1. Streamer macrumors member

    Joined:
    Apr 18, 2008
    #1
    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.

    Thanks.
     
  2. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #2
    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

    Joined:
    Apr 18, 2008
    #3
    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