I am developing an app in MonoTouch for iOS.
A big part of the functionality is that the user will need to swipe between pages (screens) of data continuously and go back and forth.
I need to keep in mind memory consumption, so my thought is I could only have a few screens in memory at a time. For example, lazy load the next 1 screen ahead of time only, so it's available when the user swipes to it. (Or lazy load on swipe).
When the user swipes back to a previous page they were on, I need to make sure that that page is still in memory and hasn't left memory. Pages that are a few behind, I can lazy re-load once the user swipes back. Therefore, I will need a mechanism to send screens to GC if they have not been viewed by the user in a while and have them automatically loaded when the user swipes to that page.
I was thinking of creating a List of objects where each object has information about what to display on the view along with a reference to the actual view itself. If this reference is null, I know to create the view. If the reference exists and is not disposed I can just show the user that existing reference. As the user swipes left and right, I can go to the next (or prev) item in the list and do the same thing. Check if it has a view reference and load that view, or create it.
Performance is key here, as the user may be swiping through potentially hundreds (or more) of screens.
Any thoughts on the best architecture for speed and memory management?