A few thoughts, not necessarily guaranteed to be correct but perhaps will get you in the right direction: If I understand your problem correctly, basically you have some concrete action that at some point (say upon completion) needs to display a modal view, but said action doesn't have a reference to the view controller that's currently on the screen (for example, maybe you're doing a task in the background and letting the user still navigate through your program, and want to alert the user on completion).
A few thoughts, not necessarily guaranteed to be correct but perhaps will get you in the right direction: If I understand your problem correctly, basically you have some concrete action that at some point (say upon completion) needs to display a modal view, but said action doesn't have a reference to the view controller that's currently on the screen (for example, maybe you're doing a task in the background and letting the user still navigate through your program, and want to alert the user on completion). I guess how you would work around this would depend on the overall architecture of your application. Most apps will have some root view controller that controls navigation: perhaps you've got a UITabBarController that you create in your app delegate, and all navigation come off that controller.
You could just display your modal view controller through this top level view controller (you'd probably be doing this inside your app delegate). Alternatively, you can let go of the idea of displaying modal view controllers and attach the view directly to your application window. If you look at a fairly popular library such as MBProgressHUD you'll see you can attach the modal loading views offered to the app window, in which all your view controllers sit.So there are a number of different strategies for achieving what you want.
I wouldn't necessarily say your problem is the result of a poor app design, since there are scenarios when you could conceivably need to display some modal dialog and not know what view controller was currently visible. That said, in the example you give - a StoreKit transaction observer that shows download progress - one would assume it would be triggered after a discrete action (purchasing a product, for example), and you would know which view controller that had been triggered from.
Thank you for the detailed answer. In the App Delegate, I sure have a reference to the root view controller (through the main window). But still it doesn't let me get instantly the current visible controller, since there may be modal controllers currently presented on top of it, and the navigation stack may be more complex.As for the example I gave, at the moment I handl I set the store controller to be the observer of the transactions, even though Apple discourages this, since unfinished transactions should be handled as soon as the application finishes launching.
– eugeniodepalo Apr 20 at 10:11 Ah, OK - I hadn't considered the possibility you'd have modal controllers already displayed (ie, modals within modals). If that's the case your simplest method might be just to override the window and dump it on top of your overall app view hierarchy. – lxt Apr 20 at 11:27.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.