Anyone know the correct way to change the UIListView items after creation ?
My code is pretty much the same as the one in UIListViewTest in the cocos2dx v2.2.0 samples.
What I do when I need to change the items text in the list is:
- Create a new CCArray with the new items string.
- Call UIListView::initChildWithDataLength( size ) with the new size of the array.
- Reset the index used in LISTVIEW_EVENT_INIT_CHILD event (m_nCount in the samples).
It works perfect.
But after some item refreshing, I get wrong behaviour. Basically, the top item in the list displays wrong text. I have to manually scroll down and then up again, and the display is correct again.
I’ve done some debugging inside my code and UIListView source, but found no evident mistake, that’s why I wonder if I’m not doing things right. How is UIListView supposed to be updated when some item text changes, for example?