去掉CCListView中的預設的網格線
最近在用cocos2d-x做一個電子書的專案,需要用到CCListView,可以CCListView中的每個cell都會有一條網格線,影響美觀,所有要把它去掉。
後來發現在CCListViewCell.cpp中的draw函式,中,註釋掉一段程式碼即可。
void CCListViewCell::draw(void)
{
CCLayerColor::draw();
CCSize size = this->getContentSize();
CCListView *owner = this->getOwner();
if (CCListViewCellSeparatorStyleSingleLine == m_nSeparatorStyle)
{
glLineWidth(1.0f);
ccDrawColor4B(m_separatorLineColor.r, m_separatorLineColor.g, m_separatorLineColor.b, 255);
/*
if (CCListViewModeHorizontal == owner->getMode())
{
ccDrawLine(CCPointMake(size.width, 0), CCPointMake(size.width, size.height));
}
else if (CCListViewModeVertical == owner->getMode())
{
ccDrawLine(CCPointMake(0, 0), CCPointMake(size.width, 0));
}*/
}
}