我有這樣的代碼和分析的XCode沒有發出任何警告,但在控制檯每一次我得到一個消息:麻煩與CALayer的
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];
}
}
圖像有多大? – 2012-07-19 19:51:56
75x75(資源縮略圖) – Torokh 2012-07-19 19:52:59
「圖像」變量的值是多少? – 2012-07-19 20:00:25