Reuse UIViewController instances when using storyboard

Viewed 9001

I decided to give the use of storyboards a go in my current iPhone app. I am facing a bit of a problem. I really need to reuse my UIViewController instances.

What do I mean by that? Well, for example I have a table view controller. When I tap a cell, another view controller is loaded from the storyboard and pushed onto the navigation controller stack. This all works well, but it takes about half a second to a second each time this view controller is loaded. Before I was using story boards I simply solved this problem by caching the created instance so the second time you tap a cell the view controller can be immediately shown.

By caching the created instance I mean something like this:

if (!cachedInstance) {
    cachedInstance = [MyViewController new];
}
[self.navigationController pushViewController:cachedInstance];

Does anyone know how to accomplish this using the storyboard? Thanks in advance.

1 Answers
Related