Note that there are some explanatory texts on larger screens.

plurals
  1. POUIView not autoreleased. Where is my issue?
    primarykey
    data
    text
    <p>I create <code>UIViews</code> based on xib files programmaticaly and add them to a <code>scrollView</code>. This works so far. If the amount changes I recreate the grid of <code>UIViews</code> (in my case so called theme thumbs). I remove the old ones before I recreate the new ones. The problem is the memory is never released and for every new creation memory usage piles up. Even if I remove one single thumb the memory isn´t released. </p> <p>Instruments doesn´t show leaks. <code>Dealloc</code> in my <code>ViewController</code> is never called.</p> <p>I use <code>ARC</code> and I know that I have to avoid retained references. But clearly I have used them and don´t understand where. It would be great if someone could give me a hint where I did it as I have read a lot of posts here but still don´t understand it. <code>NSZombiesEnabled</code> is off. </p> <p>My code:</p> <pre><code>-(void)createGrid { for (UIView *subview in self.scrollView.subviews) { if ([subview tag] &lt; 10000 &amp;&amp; ![subview isKindOfClass:[UIImageView class]]) { [subview removeFromSuperview]; } } int col = 0; int row = 0; [self setupFetchedResultsController]; for (int i = 0; i&lt;[[self.fetchedResultsController fetchedObjects] count]; i++) { col = i % THEME_COLUMNS; row = i / THEME_COLUMNS; ThemeThumbVC *themeThumb = [[ThemeThumbVC alloc] init]; [self.scrollView addSubview:themeThumb.view]; // configurate thumb themeThumb.managedObjectContext = self.managedObjectContext; themeThumb.fetchedResultsController = self.fetchedResultsController; themeThumb.theme = [[self.fetchedResultsController fetchedObjects] objectAtIndex:i]; [themeThumb.themeThumbImage setImage:[UIImage imageWithContentsOfFile:[[[self.fetchedResultsController fetchedObjects] objectAtIndex:i] iconImageURL]]]; [themeThumb setTag:i]; [themeThumb.view setTag:i]; [themeThumb.view setFrame:CGRectMake(col*kThemeGritXOffset+(col*1), row*kThemeGritYOffset, kThemeGritXOffset+1, kThemeGritYOffset)]; [self addChildViewController:(UIViewController*) themeThumb]; } [self.scrollView setContentSize:CGSizeMake(320, row*kThemeGritYOffset+kThemeGritYOffset)]; } </code></pre>
    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