I am using the following code:
UIImage *buttonImage;
if (p.placeImage != nil) {
buttonImage = [UIImage imageWithData:p.placeImage];
} else {
buttonImage = [UIImage imageNamed:@"bg_place_noimg.png"];
}
[imageButton setBackgroundImage:buttonImage forState:UIControlStateNormal];
When I run the application with tools, I see that setBackgroundImage is consuming a lot of memory. However, if I comment on the last line, this will not happen. Any possible reason?
EDIT:
If p.placeImage == nil and imageNamed: @ "bg_place_noimg.png" are used, normal memory usage is used. p.placeImage is the converted value that I use in Core Data to store NSData images downloaded from the Internet.
source
share