0

(Xcode 5,ios7,arc)i have a view controller,it have a tableview,The problem is that cell loading picture, make a memory leak. I have repeatedly push the view controller ,and then back, memory continues to increase. My English is not good, do not know whether the clear expression.
How to solve the problem of excessive picture memory, hope to master for help.
Here is the code:

@implementation SearchCell
-(void)dealloc
{
    _imageV = nil;
    _titleL = nil;
    _infoL = nil;
    _countL = nil;
}
+(instancetype) cellWithTableView:(UITableView *)tableView model:(SearchModel *)model
{
    static NSString* strID = @"SPECIALCELL";
    SearchCell* cell = [tableView dequeueReusableCellWithIdentifier:strID];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"SearchCell" owner:nil options:nil] lastObject];
    }
    [cell setSearchCellModel:model];
    return cell;
}
-(void) setSearchCellModel:(SearchModel*)model
{
    UIImage* img = [[SDWebImageManager sharedManager] imageWithURL:[NSURL URLWithString:model.tvImgURL]];
    self.imageV.image = img;
    self.titleL.text = model.tvName;
    self.infoL.text = model.tvInfo;
    self.countL.text = model.tvCount;
}
  • It might be so that your image has a very big resolution. If you resize the image to the size of the image view and set the image, it might make more sense. – Sandeep Oct 11 '14 at 10:39
  • Thank you, on the network after the pictures were very large indeed, resizing, memory has not increased by – 随风飘逸 Oct 11 '14 at 12:03

1 Answers1

0

hear you get the your answer for this question ... you need to use lasy loading image view..

i would like to give hint for that.

1). first you need to save image on document directory unique name(url name) then check if image are there in document directory then you fetch image from document directory folder and when you save image that time you save image small size use this link code easily solve your problem.

Community
  • 1
  • 1
Mitul Marsoniya
  • 5,272
  • 4
  • 33
  • 57