问题描述
- 使用图形图片设置UIView缩略图
- 对一个UIView动画用图形context做了预览图片处理。
等到释放这个数组或者图片不需要再预览时,应该怎么释放内存?
用_pictureArray = nil?
- (NSMutableArray *)generateCachedImageArrayWithFilename:(NSString *)filename extension:(NSString *)extension andImageCount:(int)count{ _imagesArray = [[NSMutableArray alloc] init]; _fileExtension = extension; _imageName = filename; _imageCount = count; for (int i = 0; i < count; i++) { NSString *tempImageNames = [NSString stringWithFormat:@""%@%i"" filename i]; NSString *imagePath = [[NSBundle mainBundle] pathForResource:tempImageNames ofType:extension]; UIImage *frameImage = [UIImage imageWithContentsOfFile:imagePath]; UIGraphicsBeginImageContext(frameImage.size); CGRect rect = CGRectMake(0 0 frameImage.size.width frameImage.size.height); [frameImage drawInRect:rect]; UIImage *renderedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); [_imagesArray addObject:renderedImage]; if (_isDoublingFrames) { [_imagesArray addObject:renderedImage]; } else if (_isTripplingFrames) { [_imagesArray addObject:renderedImage]; [_imagesArray addObject:renderedImage]; } NSLog(@""filename = %@"" filename); } return _imagesArray;}
时间: 2024-10-29 22:01:01