UIImageで大量画像を扱う場合の注意点

気晴らしにswiftでもやってみるかと本を読み出したのですが
UIImageのimageNamed: はキャッシュされて imageWithContentsOfFile: はキャッシュされないのでimageNamed: 使いすぎるとメモリ足りなくなるかもよというTIPSが記載されていました。

Referenceより抜粋

Reference見てみると確かに書いています。

# imageNamed:
This method looks in the system caches for an image object with the specified name and 
returns that object if it exists. If a matching image object is not already in the cache, this method 
locates and loads the image data from disk or asset catelog, and then returns the resulting object.
 You can not assume that this method is thread safe.

# imageWithContentsOfFile:
This method does not cache the image object.

まぁ、ただ単に私が無知なだけです。
いつも何も気にせず imageNamed: で書いていました。

imageWithContentsOfFile: は描画が遅い?

これだけなら、必要に応じてimageWithContentsOfFile: 使いましょうという話なんですが 少し調べてみると、描画が遅いという問題もあるようです。
[iPhone] UIImage #imageWithContentsOfData: などは描画が激遅 | Sun Limited Mt.
このUIImage作って、CGImageにしてからUIImage作り直すっていうworkaroundは、iOSっぽいというかなんというか。とりあえず深追いは今の所しないでおきます。

参考URL

UIImageとキャッシュ - grimleaperの開発日誌 - iPhoneアプリ開発グループ
UIImage::imageNamed:を使う上で気をつけること | Yusk's UseCase

読んでる本

初心者向け。懇切丁寧でなかなかよい。
ある程度iOSの知識はあってswiftを知るためというだけなら買わなくてもいいかも。

Swiftではじめる iPhoneアプリ開発の教科書 【iOS 8&Xcode 6対応】

Swiftではじめる iPhoneアプリ開発の教科書 【iOS 8&Xcode 6対応】