CCArray with CCListView on Cocos2d-x 2.0 rc0

Thanks for release cocos2d-x 2.0 rc0 version.
I have find out the bug in the CCArray or CCListView, I can’t confirm what should be fix.

I create the CCArray with some String.
then setup the CCListView follow the sample by test project.
After that I just put the CCArray object inside the CCListView and using the CCLabel to display it.

Example:
CCArray * layerarray have 7 item.
CCListView numberOfCells have count by: data~~>nNumberOfRows = layerarray~~>count();
CCListView cellForRow just come out to show the content by using

  • CCLayer * l = (CCLayer *)layerarray~~>objectAtIndex;
    ~~ l~~>setTag;
    ~~ cell->addChild(l);

Bug:
It can show from 0 to 5 nRow correctly.
But when I scroll it to nRow 6, it can’t be show and crash.

Environment:
I test it on android platform.

Hope both you can fix the problem or let me know is it have something wrong.

Hello. Sorry for offtop, but where do you found the example? I’ve looked at official repository https://github.com/cocos2d/cocos2d-x/tree/gles20/tests/tests and there is no example project for the CCListView. Could you please point me to the example?

you need to check for the example of CCTextureWatcher.
It is totally using CCListView to display the content.

Thank you! I’m working with User Interface and i’ll use a CCListView if i find a solution to your issue i’ll try to help you

thanks

No any developer of cocos2d-x find this bug?
Please help to check or create the issues for cocos2d-x update in the future.

I’ve created a ListView like in CCTextureWatcher and it’s work as expected. In my list i’m displaying 4 elements from 7. I think your problem may lie in the data~~>nNumberOfRows value. In my case i’m using it like this
<pre>
#define ITEMS_TO_DISPLAY 4
data~~>nNumberOfRows = (items~~>count + ITEMS_TO_DISPLAY~~ 1) / ITEMS_TO_DISPLAY;

Any difference with the abandoned CCListView and the newly added CCTableView?