Note that there are some explanatory texts on larger screens.

plurals
  1. POloading custom view using loadNibNamed showing memory leaks
    text
    copied!<p>I have a number of custom table cells and views that I built using interface builder</p> <p>In interface builder, everything is set up similarly. There is a table cell and a couple other UILabels and a background image</p> <p>Object owner if the nib is NSObject Class for the table cell is the name of the class for my table cell</p> <p>Here is how I create the table cell in my code:</p> <pre><code>SectionedSwitchTableCell *cell = nil; NSArray *nibs = [[NSBundle mainBundle] loadNibNamed:kSectionedSwitchTableCellIdentifier owner:owner options:nil]; for(id currentObject in nibs) { if([currentObject isKindOfClass:[SectionedSwitchTableCell class]]) { cell = (SectionedSwitchTableCell *)currentObject; break; } } return cell; </code></pre> <p>For my custom table headers I have this</p> <pre><code> NSArray *nibs = [[NSBundle mainBundle] loadNibNamed:@"CustomTableHeader" owner:self options:nil]; for(id currentObject in nibs) { if([currentObject isKindOfClass:[CustomTableHeader class]]) { return header } } </code></pre> <p>In my .h and .m files for the custom view, I have IBOutlet, @property set up for everything except for the background image UIImageView. Everything that has the IBOutlet and @property are also @synthesized and released in the .m file.</p> <p>Leaks is showing that I have memory leaks with CALayer when I create these custom view objects. Am I doing something wrong here when I create these custom view objects? I'm kind of tearing my hair out trying to figure out where these leaks are coming from.</p> <p>As a side note, I have a UIImageView background image defined in these custom views but I didn't define properties and IBOutlets in my .h and .m files. Defining them doesn't make a difference when I run it through Leaks but just wanted to confirm if I'm doing the right thing.</p> <p>Any input would be super helpful. Thanks :)</p>
 

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