开发者

Problems with images on iPhone

开发者 https://www.devze.com 2023-01-09 13:00 出处:网络
In my application I use lots of images based in interface builder. The problem with this is that it uses large amounts of me开发者_Go百科mory because interface builder caches it much liked \"imageName

In my application I use lots of images based in interface builder. The problem with this is that it uses large amounts of me开发者_Go百科mory because interface builder caches it much liked "imageNamed" so I've begun removing the image from imageViews in interface builder and instead adding them once the view starts using "imageWithContentsOfFile". After several hours I have made little progress because I have literally hundreds of images. I'm just wondering if there is a more straightforward way to do this?


Yes, don't do it. UIImage and the whole xib business pretty much delay loading until things are needed, as well as drop cached images where possible and needed. You can even see this happening in Instruments. It helps to split your design over several xibs, so they can be loaded when needed.

What you can do however, is to make sure that you don't scale images but display them 1:1, and that you save them in the lowest acceptable quality. For photo's, take JPEG. For other images, take PNG.

0

精彩评论

暂无评论...
验证码 换一张
取 消