Memory CollectionView VM: memory CoreAnimation asignada y abandonada

Tengo algunas vistas de colección y una vista de tabla en el mismo controller de vista. El problema bastante extraño es que cuando me desploop hacia arriba hacia abajo, siempre consigo boost la memory. Los instrumentos muestran una gran cantidad de objects VM: CoreAnimation pero no los puedo rastrear (están dentro de collectionView en sí). Prepararse para la reutilización se llama dentro de las celdas, comprobé esto.

Aquí está el código:

- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.receivedChannels = NO; self.ItemsDict = [NSMutableDictionary new]; self.crtBatchSet = [NSMutableIndexSet new]; if ([[PSDeviceInfo shanetworkingInstance] is_iPad]) { self.epgWidth = EPG_WIDTH_IPAD; } else { self.epgWidth = EPG_WIDTH_IPHONE; } crtBatchSetSize = 0; self.currentSelecteIndexOfDateCell = 0; //size self.widthDictionary = [NSMutableDictionary new]; self.centerXDictionary = [NSMutableDictionary new]; self.layout = [[MultipleLineLayout alloc] initWithWidthDictionary:self.widthDictionary andCenterXDictionary:self.centerXDictionary]; self.ItemsCollectionVIew.collectionViewLayout = self.layout; self.ItemsCollectionVIew.showsHorizontalScrollIndicator = NO; self.ItemsCollectionVIew.showsVerticalScrollIndicator = NO; self.layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; [self.ItemsCollectionVIew registerClass:[ItemColectionCell class] forCellWithReuseIdentifier:@"ItemColectionCellID"]; [self.hoursCollectionView registerClass:[HoursCollectionViewCell class] forCellWithReuseIdentifier:@"HoursColectionCellID"]; [self.datePickerCollectionView registerClass:[DatePickerCollectionViewCell class] forCellWithReuseIdentifier:@"DatePickerColectionCellID"]; } -(void)scrollViewDidScroll:(UIScrollView *)scrollView{ if (scrollView == self.ItemsCollectionVIew){ self.channelsTableView.contentOffset = CGPointMake(0, self.ItemsCollectionVIew.contentOffset.y); self.hoursCollectionView.contentOffset = CGPointMake(self.ItemsCollectionVIew.contentOffset.x, 0); } if (scrollView == self.channelsTableView) { self.ItemsCollectionVIew.contentOffset = CGPointMake(self.ItemsCollectionVIew.contentOffset.x,self.channelsTableView.contentOffset.y); } if (scrollView == self.hoursCollectionView) { self.ItemsCollectionVIew.contentOffset = CGPointMake(self.hoursCollectionView.contentOffset.x,self.ItemsCollectionVIew.contentOffset.y); } } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *channelCellID = @"ChannelTableCellID"; ChannelTableCell *cell = [tableView dequeueReusableCellWithIdentifier:channelCellID forIndexPath:indexPath]; cell.myIndexInTable = indexPath.row; cell.selectionStyle = UITableViewCellSelectionStyleNone; [cell getData]; return cell; } #pragma mark - UITableViewDelegate Methods - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ [self.ItemsCollectionVIew reloadData]; } #pragma mark - UICollectionViewDataSource Methods -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { if (collectionView == self.datePickerCollectionView || collectionView == self.hoursCollectionView) { return 1; }else{ if (self.receivedChannels) { return totalNoChannels; } else { return 1; } } } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ if (collectionView == self.datePickerCollectionView) { return DELTA_DAYS + 1; }else if (collectionView == self.hoursCollectionView) { return 48; //24 hours * 2 }else{ // if (collectionView == self.ItemsCollectionVIew){ NSArray *sectionItems = self.ItemsDict[@(section)]; if (sectionItems) { // return sectionItems.count; return 100; } else { return 100; } } return 1; } // The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath: - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ if (collectionView == self.datePickerCollectionView) { static NSString *ItemCellID = @"DatePickerColectionCellID"; DatePickerCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ItemCellID forIndexPath:indexPath]; [self setDayAndDateforCell:cell at:indexPath]; [cell setBackgroundColor:[self getColorForCell:self.currentSelecteIndexOfDateCell == indexPath.row ? YES:NO]]; return cell; }else if (collectionView == self.hoursCollectionView){ static NSString *ItemCellID = @"HoursColectionCellID"; HoursCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ItemCellID forIndexPath:indexPath]; cell.hourLabel.text = [self getTimeLineCellValuerFor:indexPath]; return cell; } else{ // if (collectionView == self.datePickerCollectionView) { static NSString *ItemCellID = @"ItemColectionCellID"; ItemColectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ItemCellID forIndexPath:indexPath]; NSArray *Items = self.ItemsDict[@(indexPath.section)]; if (indexPath.row >= Items.count) { return cell; } MvpItem *prog = Items[indexPath.row]; [cell updateInfo:prog]; [cell setBackgroundColor:[self getColorForCell:NO]]; return cell; } } #pragma mark - UICollectionViewDelegate Methods - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ if (collectionView == self.datePickerCollectionView) { self.currentSelecteIndexOfDateCell = indexPath.row; } if (collectionView == self.ItemsCollectionVIew) { [self pushDetailsatIndexPath:indexPath]; } } 

El código para la celda tableView es:

 - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code [self.layer setBorderColor:[UIColor blackColor].CGColor]; [self.layer setBorderWidth:1.0f]; } return self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (void)prepareForReuse{ self.thumbnailImage.image = nil; self.channel = nil; [self clearDelegate]; [super prepareForReuse]; } - (void)dealloc { [self clearDelegate]; } - (void)clearDelegate { NSString *url = self.channel.media_content.thumbPoster.url; // [[ImageManager shanetworkingInstance] removeDelegate:self forImgUrl:url]; [[TVManager shanetworkingInstance] removeDelegate:self]; } - (void)getData { [[TVManager shanetworkingInstance] getChannelAndItemssForIndex:self.myIndexInTable forDateDelta:0 forDelegate:self]; } - (void)didReceiveTotalNoChn:(NSInteger)totalChnNo{ return; } - (void)didReceiveChannel:(MvpChannel *)channel withItemss:(NSArray *)Itemss forDateDelta:(NSInteger)date withIndex:(NSUInteger)index{ if (index != self.myIndexInTable) { return; } if ([self.channel isEqual:channel]) { return; } self.channel = channel; NSString *imgUrl = self.channel.media_content.thumbPoster.url; // UIImage *img = [[ImageManager shanetworkingInstance] getImageForUrl:imgUrl forIndex:self.myIndexInTable withDelegate:self]; // if (img) { // self.thumbnailImage.image = img; // } } #pragma mark - Image Delegate - (void)didReceiveImage:(UIImage *)image forIndex:(NSInteger)index { if (index != self.myIndexInTable) { return; } if (image) { self.thumbnailImage.contentMode = UIViewContentModeScaleAspectFit; self.thumbnailImage.image = image; [self setNeedsLayout]; } } 

Y dentro de la colección ViewCell:

 @interface ItemColectionCell () @property (retain, nonatomic) UILabel *titleLabel; @property (retain, nonatomic) UILabel *genreLabel; @property (retain, nonatomic) UILabel *intervalLabel; @end @implementation ItemColectionCell //collection - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code [self.layer setBorderColor:[UIColor blackColor].CGColor]; [self.layer setBorderWidth:1.0f]; self.titleLabel = [[UILabel alloc] init]; self.genreLabel = [[UILabel alloc] init]; self.intervalLabel = [[UILabel alloc] init]; [self.titleLabel setBackgroundColor:[UIColor clearColor]]; [self.genreLabel setBackgroundColor:[UIColor clearColor]]; [self.intervalLabel setBackgroundColor:[UIColor clearColor]]; [self.titleLabel setTextColor:[UIColor whiteColor]]; [self.genreLabel setTextColor:[UIColor whiteColor]]; [self.intervalLabel setTextColor:[UIColor whiteColor]]; [self.titleLabel setFont:[UIFont fontWithName:@“cf-Bold" size:15]];; [self.genreLabel setFont:[UIFont fontWithName:@“cf-Regular" size:11]];; [self.intervalLabel setFont:[UIFont fontWithName:@“cf-Regular" size:11]];; } return self; } /* // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code } */ - (void)prepareForReuse{ self.titleLabel.text = nil; self.genreLabel.text = nil; self.intervalLabel.text = nil; [self.titleLabel removeFromSuperview]; [self.genreLabel removeFromSuperview]; [self.intervalLabel removeFromSuperview]; [super prepareForReuse]; } - (void)updateInfo:(MvpItem*)item{ if (!item) { return; } NSDateFormatter *startTimeFormat = [[NSDateFormatter alloc] init]; [startTimeFormat setDateFormat:@"hh:mm"]; NSDateFormatter *endTimeFormat = [[NSDateFormatter alloc] init]; [endTimeFormat setDateFormat:@"hh:mm a"]; NSString *startTime = [startTimeFormat stringFromDate:item.startTime]; NSString *endTime = [endTimeFormat stringFromDate:item.endTime]; self.titleLabel.frame = CGRectMake(10, 7, self.frame.size.width - 10, 15); self.genreLabel.frame = CGRectMake(10, 20, self.frame.size.width - 10, 15); self.intervalLabel.frame = CGRectMake(10, 32, self.frame.size.width - 10, 15); self.titleLabel.text = item.title; self.genreLabel.text = @“tewst”; self.intervalLabel.text = [NSString stringWithFormat:@"%@ - %@", startTime, endTime]; [self addSubview:self.titleLabel]; [self addSubview:self.genreLabel]; [self addSubview:self.intervalLabel]; } 

¿Qué puedo hacer para resolver este problema?

¿Trató de eliminar la celda o las tareas pesadas desencadenadas al mostrar esa celda cuando finalizó la visualización?

 - (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath 

o

 - (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath