iphone - Preventing view from unloading in iOS SDK? -


i've built app uses uitableview inside uinavigationcontroller, inside uitabbarcontroller. every entry in uitableview opens view contains basic text, buttons, importantly, mpmovieplayercontroller plays audio when started. user can click mpmovieplayercontroller , continue browse around rest of app (different tabs, or moving in navcontroller, opening other views tableview) , continue hear audio.

i'd user able return view active mpmovieplayercontroller @ time. understand how go allowing user return view view, i'm struggling how prevent view being reloaded when user tries accessing same view.

is there way can save view in memory? or save active mpmovieplayercontroller type of global object, can @ least access anywhere?

i appreciate , help. thanks!

i'd recommend create property mpmovieplayercontroller in app's uiapplicationdelegate (which can access anywhere in code [uiapplication sharedapplication].delegate need cast uiapplicationdelegate subclass).

when come enter screen plays content, check whether movie player property in app delegate nil, if create it, otherwise re-use it.

don't forget release reference mpmovieplayercontroller when media stops playing, or when media has stopped , memory warning or when app shuts down.

the down side of approach causes coupling between of view controllers , app delegate. mitigate use of protocol however.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -