Note that there are some explanatory texts on larger screens.

plurals
  1. POMemory management of view while using NavigationController
    primarykey
    data
    text
    <p>I changed navigation in my application from using UITabBarController to u UINavigationController. I.e. former solution (1st version) was based only on the TabBarController - 4 ViewControllers (one simple TableView, one simple custom view and one MapView with many overlays). The second version is based only on the UINavigationController.</p> <p>In case of TabBarController it was clear and simple, everything worked fine, especially MapView. I mean: the MapView was loaded once (with a significant number of overlays) and when I went to another view and back to the MapView the MapView was still there with its overlays already loaded and displayed (simple check: MapView`s viewDidLoad was called just once per app run, I had some debug messages there).</p> <p>Now I changed navigation logic to the UINavigationController. Everything works fine for the first look - but: the viewDidLoad (for each view) is called everytime I navigate to the view. It is annoying especially in the case of the MapView - the loading of overlays is performed everytime, it takes some time and it causes app crash in some cases.</p> <p><strong>OK, my questions:</strong></p> <ol> <li><p><strong>Is it some kind of "common" behavior of NavigationController?</strong></p></li> <li><p><strong>Can I change this behavior so viewDidLoad will be called just once?</strong></p></li> <li><p><strong>And more - How can I influence the "display sequence" of some view?</strong></p></li> </ol> <p>I understand the logic is probably more complicated but I appreciate any answer or hint ;)</p> <p>Some related circumstances:</p> <ul> <li>TabBar and Navigation controllers are not combined.</li> <li>I use storyboards, segues are designed in the UIB, no manual calling like perfomSegue or prepareForSegue in my code. One button triggers segue to MapView.</li> <li>I use push segues.</li> <li>I also tried to use modal segues but without any change of that behavior.</li> <li>any of viewDidUnload is never called during segues among the views.</li> <li>No memory warning received.</li> <li>No memory leaks measured both on simulator and iPhone 4.</li> <li>I tried to build a very simple temporary project / app that is concerned just about the Nav. Controller and other views without ANY coding, just storyboard. It was the same behavior.</li> <li>There was an issue that causes app crash when I fast and periodically tapped to navigation button and back button between one view and the MapView. In most cases the app crashed when I tapped the back button on the MapView before it was fully displayed (i.e. its overlays). It was fixed when I added a 1 sec. delay method call in the viewDidDisappeared in the MapView. It is not a fair fix, I know ;)</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload