I have a UIViewController that I want to load from a NIB that has a proxy (placeholder) object defined in it. The first time I load it, I go through this rigamarole:
MyViewController *screen = [[MyViewController alloc] init];
NSDictionary *proxyDict = [NSDictionary dictionaryWithObject:myObject forKey:@"MyProxy"];
NSDictionary *optionsDict = [NSDictionary dictionaryWithObject:proxyDict forKey:UINibExternalObjects];
[[NSBundle mainBundle] loadNibNamed:@"MyViewController" owner:screen options:optionsDict];
So this sets up the proxy object declared as "MyProxy" in the NIB file to point to the object myObject
that already exists. This much works.
Now, if I go to a different screen and trigger a low memory warning, it unloads the view. when I go back to that screen, it does the automatic reloading of the view, which has no room for a manually-defined options dictionary for setting up proxy objects, and then it crashes trying to find an object to link "MyProxy" to.
How can I make this work?