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

RossOliver

macrumors regular
Original poster
Nov 6, 2006
157
0
Hey,

I have my AppDelegate, which on start up runs my MainWindow.xib creating a mainWindowViewController. That view controller goes on to present a modal view controller, which has an instance variable I need to access upon the termination of my application (to save state). How on earth do I go about referencing this object?

Cheers,

-Ross
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Why not just save the state when that variable is changed, inside its class?
 

RossOliver

macrumors regular
Original poster
Nov 6, 2006
157
0
Why not just save the state when that variable is changed, inside its class?

Since only the AppDelegate receives the appDidTerminate (can't remember the exact method name) message it needs to call the object to inform it to save state. I managed to do this by just linking an instance variable to the view controller in AppDelegate then I got it's modalViewController, checked it to make sure the class name was correct and then I could access the property I needed...

-Ross
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.