MMDrawerController icon indicating copy to clipboard operation
MMDrawerController copied to clipboard

Preserve old center view controller

Open djibouti33 opened this issue 13 years ago • 2 comments

I have my left drawer set up in such a way that tapping a menu item replaces what is being shown in the center.

If item 1 is originally loaded, then I tap item 3, and then go back to item 1, it looks like the content for item 1 has to be recreated from scratch. In my case this means that the same web service needs to be called again.

Is there a way to somehow preserve the center view controller before it gets swapped out?

I'm looking at airbnb and YouTube and once you've loaded a menu item in the center once, it's available again instantly.

Thanks!

Kevin

djibouti33 avatar Aug 28 '13 23:08 djibouti33

I do pretty much exactly what you want in my app as well. You just need to introduce some logic in your application that keeps a reference to the controller you want to keep around.

So before you set the centerviewcontroller, just simply make a strong reference to the current controller (or else where in your code)

mmarszal avatar Aug 29 '13 10:08 mmarszal

Ya I would say setup logic in your left drawer to lazy load your center controllers, and keep references to them to restore.

kcharwood avatar Aug 29 '13 13:08 kcharwood