layoutView and NSData
Still not sure why (will follow up if I have time) but do not do this:
-(void)layoutSubviews {
NSData *imageData = [[NSData alloc] initWithContentsOfURL:imageURL];
UIImage *image = [[UIImage alloc] initWithData:imageData];
imageData = nil;
imageView.image = image;
image = nil;
// put the imageView somewhere or something
}
That NSData will not be reclaimed as expected (I'm assuming ARC). If a view needs to render a UIImageView from an image file then pull it into memory outside of view rendering code.
Written by Pierre Larochelle
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Objective-c
Authors
Related Tags
#objective-c
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#