0

I have 3 view controllers: Main, List and Run. (More will be added later.) I'm using storyboards and segues. The target OS is iOS 8. Main is the initial scene/controller. At present, I am not using any navigation controllers.

A button on Main presents List via a show segue. Depending on user interaction, List may return to Main using an unwind segue or be overlayed by Run using a show segue via performSegueWithIdentifier programatically. So far, so good.

Once List segues to Run, list will never be used again. Run will never unwind to List.

When the user exists Run, an unwind segue is fired taking the user back to Main. The problem is that List never gets deactivated. (In swift, List.deinit() is never called.) I am careful to nil all pointers to List (including delegates) before the segue from List to Run. If List unwinds to Main directly, without presenting Run, List is deallocated just as it should be.

So, what am I doing in the List-to-Run followed by Run-to-Main segues that prevents List from being deallocated?

Note that I am not using a navigation controller because I don't need the navigation bar (I know it can be hidden), and because List is not the only VC that can segue to Run; there will be several others.

Bruce L
  • 229
  • 2
  • 3
  • It's hard to say what's wrong because what you're describing shouldn't be happening. If you use an unwind to go from Run to Main, both Run and List should be deallocated; that's what I see when I try it (Xcode 6.3.1). – rdelmar Jun 05 '15 at 21:58
  • Thanks @peter. I'm running Xcode 6.3.2 and swift. I will try adding a navigation controller and see if it makes a difference. – Bruce L Jun 06 '15 at 18:37

1 Answers1

1

By imbedding Main in a navigation controller, the problem goes away and all view controllers deactivate when they should. No other code changes were needed.

I find this result surprising. It would seem to indicate that navigation controllers ought to be used in most (all?) storyboard applications.

Bruce L
  • 229
  • 2
  • 3