Created
July 2, 2014 20:34
-
-
Save icodeforlove/30838a882e0c71b9a4d5 to your computer and use it in GitHub Desktop.
gives CCTableView the ability to dequeueCellWithTag, this is very useful when using multiple custom CCTableViewCell's and wanting to be able to reuse them.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CCTableViewCell *CCTableView::dequeueCellWithTag(int nTag) | |
{ | |
CCTableViewCell *cell = NULL; | |
for (int i = 0, len = m_pCellsFreed->count(); i < len; i++) { | |
CCTableViewCell *tempCell = (CCTableViewCell*)m_pCellsFreed->objectAtIndex(i); | |
if (tempCell->getTag() == nTag) { | |
cell = tempCell; | |
cell->retain(); | |
m_pCellsFreed->removeObjectAtIndex(i); | |
cell->autorelease(); | |
break; | |
} | |
} | |
return cell; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment