views:

281

answers:

0

Say I have two views: "day view" and "week view". In the week view, tapping on a day opens the day view for that day. I have a root view controller with two buttons: one leading to a day view for today, the other to the current week view.

I want to be able to push any one of the view controllers on the UINavigationViewController's stack from anywhere. To this end, I currently have a dictionary containing my views (notably, references to my DayViewController and WeekViewController instances) in the app delegate and expose it as a property.

Of course this works, since I can always get a reference to my app delegate. But is it the "right" way of doing it? (Seems to me it should rather be my root view controller's responsibility; but [[[[[UIApplication sharedApplication] delegate] rootVC] views] objectForKey:@"dayView"] doesn't really seem any better…)

What is the "correct" place to hold the references to your shared views?