Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hiddenpremise

macrumors regular
Original poster
Hi,
I have two objects that I use two control the interfaces of two different windows in my application. Since ApplicationMagic takes care of creating instances of these controllers at start up, I am lost on how to refer to them. If I want to send one a message, how do I know what the name of the instance is?
Thanks much,
Whit

Controllers:
mainController : NSObject
secondController : NSObject

secondController contains a method "-(void) receive: (NSString *)pItem;"

I want to call the instance of secondController that is created at startup from the mainController and send it an item "[nameIDontKnow receive:mad:"Hi"];"
 
I don't know what ApplicationMagic is, but if they are in a nib/xib you can make and connect outlets, if created programmatically, you need to grab a reference to one and store it in the object you want to access it from. The mainController should probably be creating secondary controllers, so make a secondaryController variable in your main and assign it wherever you create it. If for some reason you can't do that (ApplicationMagic again?) you could maybe have the secondary send out a notification when it's initialized that the primary receives, passing itself for reference, where you assign it to your holder variable.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.