本文整理汇总了C++中CAListViewCell::setFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ CAListViewCell::setFrame方法的具体用法?C++ CAListViewCell::setFrame怎么用?C++ CAListViewCell::setFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAListViewCell
的用法示例。
在下文中一共展示了CAListViewCell::setFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadCell
void CAListView::loadCell()
{
DRect rect = this->getBounds();
rect.origin = getContentOffset();
rect.origin.y -= rect.size.height * 0.1f;
rect.origin.x -= rect.size.width * 0.1f;
rect.size.width *= 1.2f;
rect.size.height *= 1.2f;
std::map<unsigned int, CAListViewCell*>::iterator itr;
for (itr = m_mpUsedListCells.begin(); itr != m_mpUsedListCells.end(); itr++)
{
CC_CONTINUE_IF(itr->second != NULL);
unsigned int index = itr->first;
DRect cellRect = m_rIndexRects[index];
CC_CONTINUE_IF(!rect.intersectsRect(cellRect));
CAListViewCell* cell = m_pListViewDataSource->listViewCellAtIndex(this, cellRect.size, index);
if (cell)
{
cell->m_nIndex = index;
cell->updateDisplayedAlpha(this->getAlpha());
addSubview(cell);
cell->setFrame(cellRect);
m_mpUsedListCells[index] = cell;
m_vpUsedListCells.pushBack(cell);
}
if (m_pSelectedListCells.count(index))
{
cell->setControlState(CAControlStateSelected);
}
if (m_pListViewDataSource)
{
m_pListViewDataSource->listViewWillDisplayCellAtIndex(this, cell, index);
}
CAView* view = this->dequeueReusableLine();
DRect lineRect = m_rLineRects[index];
if (view == NULL)
{
view = CAView::createWithFrame(lineRect, m_obSeparatorColor);
}
m_pUsedLines[index] = view;
this->insertSubview(view, 1);
view->setFrame(lineRect);
}
}
示例2: reloadData
void CAListView::reloadData()
{
if (m_pListViewDataSource == NULL)
return;
this->reloadViewSizeData();
this->removeAllSubviews();
m_pUsedLines.clear();
m_pUsedListCells.clear();
m_pFreedListCells.clear();
m_pSelectedListCells.clear();
CCRect winRect = this->getBounds();
winRect.origin = this->getContentOffset();
if (m_nListHeaderHeight > 0)
{
if (m_pListHeaderView)
{
m_pListHeaderView->setFrame(m_rHeaderRect);
addSubview(m_pListHeaderView);
}
}
unsigned int cellCount = m_pListViewDataSource->numberOfIndex(this);
for (unsigned i = 0; i < cellCount; i++)
{
if (m_nIndexs > 0)
{
std::pair<std::map<unsigned int, CAListViewCell*>::iterator, bool> itrResult =
m_pUsedListCells.insert(std::make_pair(i, (CAListViewCell*)NULL));
CC_CONTINUE_IF(!winRect.intersectsRect(m_rIndexRects[i]));
CAListViewCell* pCellView = m_pListViewDataSource->listViewCellAtIndex(this, m_rIndexRects[i].size, i);
if (pCellView)
{
pCellView->m_nIndex = i;
pCellView->setFrame(m_rIndexRects[i]);
addSubview(pCellView);
itrResult.first->second = pCellView;
}
}
if (m_nSeparatorViewHeight > 0)
{
CAView* view = CAView::createWithFrame(m_rLineRects[i], m_obSeparatorColor);
addSubview(view);
m_pUsedLines[i] = view;
}
}
if (m_nListFooterHeight > 0)
{
if (m_pListFooterView)
{
m_pListFooterView->setFrame(m_rFooterRect);
addSubview(m_pListFooterView);
}
}
this->layoutPullToRefreshView();
this->startDeaccelerateScroll();
}