Title: How to dequeueCell in a CCTableView with multiple custom CCTableViewCell’s?
Tags: c++;cocos2d-x
Question: I have a CCTableView that i would like to use multiple custom CCTableViewCells, but it seems that dequeueCell treats all cells as if they were the same. The other option is to have a different cell for each row but this is not performant.
Oh and this is cocos2dx v2.2

Here is the accepted answer: I actually came up with a decent solution but it requires adding this member to CCTableView
CCTableViewCell *CCTableView75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0queueCellWithTag(int nTag)
CCTableViewCell *cell = NULL;
for (int i = 0, len = m_pCellsFreed-&gt;count(); i < len; i++) {
CCTableViewCell *tempCell = (CCTableViewCell*)m_pCellsFreed-&gt;objectAtIndex(i);
if (tempCell-&gt;getTag() == nTag) {
cell = tempCell;
cell-&gt;retain();
m_pCellsFreed-&gt;removeObjectAtIndex(i);
cell-&gt;autorelease();
break;
}
return cell;
Basically you do cell-&gt;setTag(tagId) on your cell after you create it and then you tableView-&gt;dequeueCellWithTag(tagId). Hopefully this could be built in because its pretty standard.
If anyone knows a better way i'm open to suggestions!


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2014:00:07/02/14', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<c++><cocos2d-x>', 'Title': 'How to dequeueCell in a CCTableView with multiple custom CCTableViewCell’s?', 'ViewCount': 322, 'id': 24540633, 'user_AboutMe': '', 'user_AccountId': 36367.0, 'user_DisplayName': 'Chad Scira', 'user_Reputation': 9513.0, 'user_Views': 1240.0, 'user_id': 103696.0}}