void CACollectionView::loadCollectionCell() { CCRect rect = this->getBounds(); rect.origin = getContentOffset(); rect.origin.y -= rect.size.height * 0.1f; rect.size.height *= 1.2f; std::map<CAIndexPath3E, CACollectionViewCell*>::iterator itr; for (itr = m_pUsedCollectionCells.begin(); itr != m_pUsedCollectionCells.end(); itr++) { CC_CONTINUE_IF(itr->second != NULL); CAIndexPath3E r = itr->first; CCRect cellRect = m_rUsedCollectionCellRects[r]; CC_CONTINUE_IF(!rect.intersectsRect(cellRect)); CACollectionViewCell* cell = m_pCollectionViewDataSource->collectionCellAtIndex(this, cellRect.size, r.section, r.row, r.item); if (cell) { cell->m_nSection = r.section; cell->m_nRow = r.row; cell->m_nItem = r.item; cell->updateDisplayedAlpha(this->getAlpha()); this->addSubview(cell); cell->setFrame(cellRect); itr->second = cell; if (m_pSelectedCollectionCells.count(r)) { cell->setControlStateSelected(); } } } }