Ejemplo n.º 1
0
void CAListView::recoveryCollectionCell()
{
	CCRect rect = this->getBounds();
	rect.origin = getContentOffset();
    rect.origin.y -= rect.size.height * 0.1f;
    rect.size.height *= 1.2f;
    
	std::map<unsigned int, CAListViewCell*>::iterator itr;
	for (itr = m_pUsedListCells.begin(); itr != m_pUsedListCells.end(); itr++)
	{
		CAListViewCell* cell = itr->second;
		CC_CONTINUE_IF(cell == NULL);

		CCRect cellRect = cell->getFrame();
		CC_CONTINUE_IF(rect.intersectsRect(cellRect));

		m_pFreedListCells[cell->getReuseIdentifier()].pushBack(cell);
		cell->removeFromSuperview();
		cell->resetListViewCell();
		itr->second = NULL;
        
        
        CAView* line = m_pUsedLines[itr->first];
        CC_CONTINUE_IF(line == NULL);
        m_pFreedLines.pushBack(line);
        line->removeFromSuperview();
        m_pUsedLines[itr->first] = NULL;
	}
}
Ejemplo n.º 2
0
void CAListView::clearData()
{
	std::map<unsigned int, CAView*>::iterator it = m_pUsedLines.begin();
	for (; it != m_pUsedLines.end(); ++it)
	{
		CAView* view = it->second;
		CC_CONTINUE_IF(view == NULL);
		m_pFreedLines.pushBack(view);
		view->removeFromSuperview();
	}
	m_pUsedLines.clear();

	m_mpUsedListCells.clear();

	for (int i = 0; i < m_vpUsedListCells.size(); i++)
	{
		CAListViewCell* cell = m_vpUsedListCells.at(i);
		CC_CONTINUE_IF(cell == NULL);
		m_mpFreedListCells[cell->getReuseIdentifier()].pushBack(cell);
		cell->removeFromSuperview();
		cell->resetListViewCell();
	}
	m_vpUsedListCells.clear();

	m_pSelectedListCells.clear();
	
	m_nIndexs = 0;
	m_rIndexRects.clear();
	m_rLineRects.clear();
	m_rHeaderRect = m_rFooterRect = DRectZero;
	m_pHighlightedListCells = NULL;
}