Image 从Url加载多个图像会在滚动时导致内存警告和应用程序崩溃
我正在使用SdWebImage异步加载图像 首先,我使用Scrollview和image view加载由内存警告引起的图像 然后我转移了集合视图,仍然有内存问题。现在我想释放屏幕外图像视图的内存,这将减少内存使用Image 从Url加载多个图像会在滚动时导致内存警告和应用程序崩溃,image,memory-management,uicollectionview,Image,Memory Management,Uicollectionview,我正在使用SdWebImage异步加载图像 首先,我使用Scrollview和image view加载由内存警告引起的图像 然后我转移了集合视图,仍然有内存问题。现在我想释放屏幕外图像视图的内存,这将减少内存使用 -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { CustomColl
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
CustomCollectionCell *cell = (CustomCollectionCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"MyCell" forIndexPath:indexPath];
[cell.Imgview sd_setImageWithURL:[NSURL URLWithString:[[[self.Actualimagearray objectAtIndex:indexPath.item]objectForKey:@"FilePath"]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] placeholderImage:[UIImage imageNamed:@"loader.png"]];
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath
{
CustomCollectionCell *customcell=(CustomCollectionCell *)cell;
customcell.Imgview=nil;
}
因此,在使用DiEndDisplay单元后,我没有收到任何内存问题,但我的图像在滚动时发生了变化(第二个图像进入第一个,第三个图像进入第二个等等)
那么,释放未发现图像的记忆的更好方法是什么呢