我有这段代码,XCode Analyze 没有发出任何警告,但是每次我在控制台中收到一条消息:
2012-07-19 23:15:35.122 AttachIt [5725:907] 收到内存警告。
我的错在哪里,请指出。
for(int j=0;j<images;j++){
@autoreleasepool {
NSInteger currentRow = 0;
for(int k = 0; k<i;k++)
currentRow = currentRow + [[assetGroups objectAtIndex:k] numberOfAssets];
asset = [assets objectAtIndex:j+currentRow];
float size = [self getRandomNumberBetweenMin:60.0 andMax:65.0];
CGRect rect;
if(iPad)
rect = CGRectMake(10+j*35.5, 75-size, size, size);
else
rect = CGRectMake(10+j*26, 75-size, size, size);
UIImageView *temp = [[UIImageView alloc] initWithImage:[UIImage imageWithCGImage:[asset thumbnail]]];
temp.frame = rect;
temp.layer.backgroundColor = [UIColor blueColor].CGColor;
temp.layer.shadowOffset = CGSizeMake(0, 3);
temp.layer.shadowRadius = 5.0;
temp.layer.shadowColor = [UIColor blackColor].CGColor;
temp.layer.shadowOpacity = 0.8;
temp.layer.masksToBounds = NO;
temp.layer.borderColor = [[UIColor whiteColor] CGColor];
temp.layer.borderWidth = 2;
[temp setTransform:CGAffineTransformMakeRotation(degreesToRadians([self getRandomNumberBetweenMin:-5 andMax:5]))];
temp.layer.shouldRasterize = TRUE;
[albumRow addSubview:temp];
}
}