UIImageView 320x480分配了多少内存?

时间:2010-02-25 17:51:57

标签: iphone memory

UIImageView 320x480分配了多少内存?

2 个答案:

答案 0 :(得分:1)

一堆?有辅助对象,指向其他对象的属性等。试图追踪可能发生的一切可能不值得。为什么你需要知道?

查看this question,其中包含有关运行时的一些有用的信息。

答案 1 :(得分:1)

通常情况下,320x480 UIView会为图层的缓冲区消耗额外的320 * 480 * 4字节,但在OS 3.0中UIImageView已优化为直接使用源UIImage

维护高级UIView接口所需的开销很小。为了进一步减少这种情况,您可以创建CALayer并直接分配内容:

CALayer *layer = [CALayer layer];
[layer setFrame:CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)];
[layer setContents:(id)[image CGImage]];
[[superview layer] addSublayer:layer];
相关问题