本文整理汇总了C++中CATableViewCell::setFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ CATableViewCell::setFrame方法的具体用法?C++ CATableViewCell::setFrame怎么用?C++ CATableViewCell::setFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CATableViewCell
的用法示例。
在下文中一共展示了CATableViewCell::setFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadTableCell
void CATableView::loadTableCell()
{
CCRect rect = this->getBounds();
rect.origin = getContentOffset();
rect.origin.y -= rect.size.height * 0.1f;
rect.size.height *= 1.2f;
for (unsigned int i=0; i<(unsigned int)m_rTableCellRectss.size(); i++)
{
for (unsigned int j=0; j<(unsigned int)m_rTableCellRectss.at(i).size(); j++)
{
CAIndexPath2E indexPath = CAIndexPath2E(i, j);
CC_CONTINUE_IF(m_pUsedTableCells.count(indexPath) && m_pUsedTableCells[indexPath]);
CCRect cellRect = m_rTableCellRectss[i][j];
CC_CONTINUE_IF(!rect.intersectsRect(cellRect));
CATableViewCell* cell = m_pTableViewDataSource->tableCellAtIndex(this, m_rTableCellRectss[i][j].size, i, j);
CC_CONTINUE_IF(cell == NULL);
cell->m_nSection = i;
cell->m_nRow = j;
cell->updateDisplayedAlpha(this->getAlpha());
m_pContainer->addSubview(cell);
cell->setFrame(m_rTableCellRectss[i][j]);
m_pUsedTableCells[indexPath] = cell;
if (m_pSelectedTableCells.count(indexPath))
{
cell->setControlStateSelected();
}
CAView* view = this->dequeueReusableLine();
CCRect lineRect = m_rLineRectss[i][j];
if (view == NULL)
{
view = CAView::createWithFrame(lineRect, m_obSeparatorColor);
}
m_pUsedLines[indexPath] = view;
this->insertSubview(view, 1);
view->setFrame(lineRect);
}
}
}
示例2: reloadData
void CATableView::reloadData()
{
this->reloadViewSizeData();
this->removeAllSubviews();
float width = this->getBounds().size.width;
int y = 0;
if (m_pTablePullDownView)
{
m_pTablePullDownView->setFrame(CCRect(0, -(float)m_nTablePullViewHeight, width, m_nTablePullViewHeight));
this->addSubview(m_pTablePullDownView);
}
if (m_pTablePullUpView)
{
m_pTablePullUpView->setFrame(CCRect(0, this->getBounds().size.height, width, m_nTablePullViewHeight));
this->addSubview(m_pTablePullUpView);
}
if (m_pTableHeaderView)
{
m_pTableHeaderView->setFrame(CCRect(0, y, width, m_nTableHeaderHeight));
this->addSubview(m_pTableHeaderView);
y += m_nTableHeaderHeight;
}
unsigned int sectionCount = m_pTableViewDataSource->numberOfSections(this);
m_rTableCellRectss.resize(sectionCount);
for (unsigned int i=0; i<sectionCount; i++)
{
CAView* sectionHeaderView = m_pTableViewDataSource->tableViewSectionViewForHeaderInSection(this, i);
if (sectionHeaderView)
{
sectionHeaderView->setFrame(CCRect(0, y, width, m_nSectionHeaderHeights.at(i)));
this->addSubview(sectionHeaderView);
}
y += m_nSectionHeaderHeights[i];
m_rTableCellRectss[i].resize(m_nRowHeightss[i].size());
for (unsigned int j=0; j<m_rTableCellRectss[i].size(); j++)
{
m_rTableCellRectss[i][j] = CCRect(0, y, width, m_nRowHeightss[i][j]);
CATableViewCell* cell = m_pTableViewDataSource->tableCellAtIndex(this, i, j);
cell->setFrame(m_rTableCellRectss[i][j]);
this->addSubview(cell);
cell->setSection(i);
cell->setRow(j);
m_pTableCells.push_back(cell);
y += m_nRowHeightss[i][j];
if (j < m_nRowHeightss.at(i).size() - 1)
{
CAView* view = CAView::createWithFrame(CCRect(0, y, width, 1), m_separatorColor);
this->addSubview(view);
y += 1;
}
}
CAView* sectionFooterView = m_pTableViewDataSource->tableViewSectionViewForFooterInSection(this, i);
if (sectionFooterView)
{
sectionFooterView->setFrame(CCRect(0, y, width, m_nSectionFooterHeights.at(i)));
this->addSubview(sectionFooterView);
}
y += m_nSectionFooterHeights.at(i);
}
if (m_pTableFooterView)
{
m_pTableFooterView->setFrame(CCRect(0, y, width, m_nTableFooterHeight));
this->addSubview(m_pTableFooterView);
y += m_nTableFooterHeight;
}
}