1. UICollectionViewController,必须传入一个非空的layout的参数,在初始化init方法self =[super initWithCollectionViewLayout:layout]

  2.在加载代码或Xib时,需调用[self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:NJIdentifier],或[self.collectionView registerNib:nib forCellWithReuseIdentifier:NJIdentifier];

  3.在- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath方法中调用Cell = [collectionView dequeueReusableCellWithReuseIdentifier:NJIdentifier forIndexPath:indexPath];会在缓存池中寻找对应的Cell.

 

 posted on 2014-06-22 20:33  zhao yan  阅读(308)  评论(1编辑  收藏  举报