나는 최근 메모리 충돌 데와 내가 배열을 비우 실패하고 있음을 의심하고 추가 유지, 이것은배열은 단지 객체와 메모리 충돌
- (void)viewDidLoad
{
allImagesArray = [[NSMutableArray alloc] init];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *[email protected]"Bottoms";
NSString *fPath = [documentsDirectory stringByAppendingPathComponent:location];
NSArray *directoryContent = [[NSFileManager defaultManager] directoryContentsAtPath: fPath];
collectionBottoms.delegate =self;
collectionBottoms.dataSource=self;
for(NSString *str in directoryContent){
NSLog(@"i");
NSString *finalFilePath = [fPath stringByAppendingPathComponent:str];
NSData *data = [NSData dataWithContentsOfFile:finalFilePath];
if(data)
{
UIImage *image = [UIImage imageWithData:data];
[allImagesArray addObject:image];
NSLog(@"array:%@",[allImagesArray description]);
}}
}
호 내가를 확보 할 수 있습니다 배열 내 코드입니다 배열에있는 객체를 해제하여 메모리를?
필요없는 경우 이미지를 어레이에서 제거 하시겠습니까? –
정확히 ... 배열에있는 한 그들은 살아있을 것입니다. – borrrden
내가 할 수있는 곳을 찾을 수 없다. 코드를 넣어 두었다.'[allImagesArray removeAllObjects]; NSLog (@ "% @", allImagesArray);}'그러나 좋은 장소를 찾을 수 없습니다. 먼저 그림을 저장하여 문서에 저장하고 싶습니다. 그러나 위 코드를 넣으면 방금 찍은 그림이 삭제됩니다. – interdatega