Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue with view controllers - Prior controller (images/content) is still present (Its not *gone*/dealloc'd/released)
    primarykey
    data
    text
    <p>So, </p> <p>I started typically by init the controller from the nib and popping it onto the view stack. But the problem is that the first controller isn't really gone - its still around.</p> <p>So, we started down the path of this:</p> <p>Starting w/the appDelegate and loading the RootViewController:</p> <pre><code>mRootController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil]; [(m42Window *)[application.windows objectAtIndex:0] setController:mRootController]; </code></pre> <p>Going from RootViewController to RegionViewController:</p> <pre><code>RegionViewController *controller = [[RegionViewController alloc] initWithNibName:@"RegionViewController" bundle:nil]; [[self getWindow] setController:controller]; [controller release]; </code></pre> <p>And the method:</p> <pre><code>- (void) setController:(m42ViewController *)controller { if (mController != nil) { for (UIView *view in mController.view.subviews) { if (view != nil) { [view removeFromSuperview]; } } [mController.view removeFromSuperview]; [mController release]; mController = nil; } mController = controller; [mController retain]; [self insertSubview:mController.view atIndex:1]; } </code></pre> <p>Pictures of the issue here: RootViewController: <a href="http://mr-sk.com/img/rootViewController.png" rel="nofollow noreferrer">http://mr-sk.com/img/rootViewController.png</a> RegionViewController (Images visible from RootViewController): <a href="http://mr-sk.com/img/regionViewController.png" rel="nofollow noreferrer">http://mr-sk.com/img/regionViewController.png</a></p> <p>Now the issue is that images in the RootViewController are visible (I have an empty UIImageView that shows images on the controller <em>below</em> it) in the RegionViewController - for whatever reason the view isn't actually being removed from the super view and released. For many reason's we want these views gone:</p> <ol> <li>Memory foot print - why hold onto all kinds of assets we don't need. We can recreate them if the user navigates back</li> <li>Code - what if code is running in those other controllers. Well, we don't want that in this case. We want them gone.</li> </ol> <p>So, what's wrong? Fundamentally, we've must have missed something in iphone 101 class. heh. I saw we cause this is myself and another guy.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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