Dear list,

Short version: What's the correct way to load a UIViewController when the
application starts, and then restore it (much) later?

*

I found creating UIViewControllers with somewhat complex Views to be a
fairly expensive operation, so instead of just creating and pushing them
onto the Navigator when needed, I had the idea to load all heavy views into
a simple object cache when the app starts (with a nice loading screen), and
then push/pop them at will while keeping them in memory. It works something
like this:

1 AppStartUp
|--- cache["finalView"] = new ComplexViewController();
|--- push Menu A onto the navigator
|
2 Menu A Controller
| --- user makes some kind of selection
| --- (cache["finalView"] as
ComplexViewController).UpdateViewWithSelectionFromMenuA()
|---  push Menu B onto the navigator
|
3 Menu B Controller
| --- user makes some kind of selection
| --- (cache["finalView"] as
ComplexViewController).UpdateViewWithSelectionFromMenuB()
|---  push cache["finalView"] onto the navigator
|
4 ComplexViewController
| --- OMG Ponies!


This method at first seemed to work great, and made the transition between
Menu B and ComplexViewController *a lot* smoother. However, things started
to fall apart recently with stuff going missing from the views in the cache.
So, I started adding lots of SetNeedsDisplay() in their ViewWillAppear
methods, and this somewhat worked - except for UITables. And some custom
controls. I'm fairly certain I've gone down the wrong path here, so are
there any best practices for doing what I'm trying to accomplish?

Any help or hints would be much appreciated!

/ V

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Correct-way-to-cache-and-restore-a-UIViewController-tp4655514.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to