chewy
chewy

Reputation: 8267

Conceptual question related to Model–view–controller on iOS

The question deals with an application which uses many views in a UINavigation controller Style. In the background there is a process which load and cache data, the process is rather extensive, which can take quite some time, that said it is designed to run on separate thread(s) doing it's loading task in the background - while the other views are present and active to the user.

Question: Assuming I would like to show the progress running in the background to the user, for example a progress view or alike. I shouldn't think that each view should have a progressView which is populating and controlled by some Notification / Listener mechanism.

Logic tells me that there should be a way to have only a single progress view which is present in all views and somehow being called only once, allocated only once and so on.

If my logic is right, how should one approach this , where should this element be placed?

any ideas, philosophy or clues would be highly appricated.

Upvotes: 0

Views: 183

Answers (2)

vikingosegundo
vikingosegundo

Reputation: 52237

Every UIView, that is added to the view hierarchy, has a property window. A UIWindow is also a UIView, so you just can add a view to it and it will be overlaying any other view.

edit
I wrote an example: https://github.com/vikingosegundo/my-programming-examples/tree/master/OverlayTest

Upvotes: 1

Alastair Stuart
Alastair Stuart

Reputation: 4185

Add it as a subview to the UIWindow, above the UINavigationController's view. This is how I do overlays for achievements etc, which can happen at any time.

Upvotes: 0

Related Questions