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

HiRez

macrumors 603
Original poster
Jan 6, 2004
6,250
2,576
Western US
Hi, I've got a document-based Cocoa app with an app controller object. I've instantiated that in the MainMenu xib and made it the NSApp delegate. So far, so good. The problem is, I want objects in my NSDocument's xib file to connect to the app controller object. I can drag another custom object out in the document's xib and make it the app controller class, but that's going to give me one controller per document, right? Not what I want, it's a singleton app controller.

Now I can make it work by making an "appCon" instance variable in the NSDocument class and setting that programmatically with appCon = [NSApp delegate];. But, this just seems kind of sloppy to me, routing those calls through the NSDocument class. That fine if that's the way it is, just wondering if there's some cleaner way to go about it that I'm missing, where I can connect to an app controller object directly in the document's xib file.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.