我对UIImage记忆规模感到不安。
When you have 320*320 resolution image data(png), when you load the image onto memory,
using [UIImage imageWithData:], the resulting UIImage will take up 320*320*4?屏幕大小(分辨率)是否影响对图像的记忆使用?
Would the code below take up twice memory size of myImage or just single image memory size? (320*320*4) * 2 vs (320*320*4)? or something else?
UIImage* myImage = [UIImage imageWithData:]; myImage = [myImage scaleToSize:];
比额表 定义
- (UIImage*)scaleToSize:(CGSize)size { // Create a bitmap graphics context // This will also set it as the current context UIGraphicsBeginImageContext(size); // Draw the scaled image in the current context [self drawInRect:CGRectMake(0, 0, size.width, size.height)]; // Create a new image from current context UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext(); // Pop the current context from the stack UIGraphicsEndImageContext(); // Return our new scaled image return scaledImage; }