Question

normally after a modal transition, the second viewController runs further "behind" the visible ViewController in the background.

Is there a possibility to completely unload the second ViewController ?? If don't want to use push, because I want an animation on the transition...

Was it helpful?

Solution

Several points:

  • You are worrying about something that is not a worry. View controllers are lightweight, simple objects. The only heavyweight object is the view, and it is in fact removed from the interface when another view controller's view is presented in its place.

  • The game does not "run in the background". If it does, you're doing it wrong. You should be detecting in viewDidDisappear: that your view is no longer in the interface and stopping all the activity. That's what these sorts of events are for.

  • If you're still bent on making certain the view controller itself is destroyed when the game is not showing, then use a different architecture. For example, present the game controller. When the game controller is dismissed, it will be released and destroyed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top