Friday, 6 September 2013

iOS Storyboard View Controller Persistence

iOS Storyboard View Controller Persistence

I'm working with a tab bar application with one storyboard built with the
iOS 6 SDK and the minimum target as iOS 5.
iOS creates view controllers in my tab bar controller as soon as the app
launches however any other view controllers are obviously not created
until the user opens it.
Occasionally, I need to send out refresh notifications to my view
controllers. The view controllers in my tab bar are always loaded and
refresh accordingly. However, other view controllers are created and
destroyed as they appear and disappear. In some instances, I need to load
the VC and refresh the data before the user opens it.
Is my only option to use UIStoryboards
instantiateViewControllerWithIdentifier: and hold on to the controller
myself? This seems very inefficient as it makes it impossible to apply a
standard refresh system across the app.
Ideally I'd like to force certain view controllers from my storyboard to
instantiate themselves and then destroy them on my own. Does anyone know
if I can do this? Or is there another solution I should try?
Edit: In this particular case, I need to populate a badge from the data
this VC retrieves.

No comments:

Post a Comment