示例#1
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;
}
示例#2
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;
	}
}
示例#3
0
void CATableView::recoveryTableCell()
{
    CCRect rect = this->getBounds();
    rect.origin.y -= rect.size.height * 0.1f;
    rect.size.height *= 1.2f;
    
    std::map<CAIndexPath2E, CATableViewCell*>::iterator itr;
    for (itr=m_pUsedTableCells.begin(); itr!=m_pUsedTableCells.end(); itr++)
    {
        
        CATableViewCell* cell = itr->second;
        CC_CONTINUE_IF(cell == NULL);
        CCRect cellRect = cell->getFrame();
        cellRect.origin = m_pContainer->convertToWorldSpace(cellRect.origin);
        cellRect.origin = this->convertToNodeSpace(cellRect.origin);
        
        CC_CONTINUE_IF(rect.intersectsRect(cellRect));
        m_pFreedTableCells[cell->getReuseIdentifier()].pushBack(cell);
        cell->removeFromSuperview();
        cell->resetTableViewCell();
        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;
    }
}
示例#4
0
void CANavigationController::replaceViewControllerFinish()
{
    CAView* newContainer = m_pContainers.back();
    newContainer->setFrameOrigin(DPointZero);
    
    size_t index = m_pViewControllers.size() - 2;
    CAViewController* lastViewController = m_pViewControllers.at(index);
    lastViewController->viewDidDisappear();
    lastViewController->m_pNavigationController = NULL;
    lastViewController->removeViewFromSuperview();
    m_pViewControllers.erase(index);
    
    CAView* backContainer = m_pContainers.at(index);
    backContainer->removeFromSuperview();
    m_pContainers.erase(index);
    m_pSecondContainers.erase(index);
    m_pNavigationBars.erase(index);
    CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsTrue();
}