2014 04 23 ios collectionview create collectionview programmatically

create collectionview programmatically

UICollectionView ではあらかじめセルのクラスを登録しておくことで、再利用可能なセルがない場合に新しく作成したものを返してくれるようになっています。
そのため dequeueReusableCellWithReuseIdentifier: が nil を返しません。

imageを使う方法

http://stackoverflow.com/questions/19269266/reused-cells-in-a-uicollectionview-show-multiple-uiimageviews-when-they-should-o