TableView's inconsistent behaviour

I am using TableView in two different areas in my app. The behaviour is strangely different while I think the code is similar. The desired behaviour is as in the video below. When I pull down it snaps back to the top. When I pull up, the cells are truncated at the top and it snaps back. The cells do not go pass the top. The code for this follows:

https://discuss.cocos2d-x.org/uploads/default/original/3X/c/0/c087955a8d1e1be2803fe861e23b82a97c46fdf5.mov

pagesTableView = TableView::create(this, Size(panelWidth, contentHeight));
pagesTableView->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
pagesTableView->setPosition(Vec2(xp,yp));
pagesTableView->setVerticalFillOrder(TableView::VerticalFillOrder::TOP_DOWN);
pagesTableView->setDelegate(this);

The next table view does not clip off the top. The cells go pass the top position, and do not snap back.

https://discuss.cocos2d-x.org/uploads/default/original/3X/7/2/72c4a3e0daaf0e2bed9ca6b68fb52f54c6e86f8d.mov

itemsTableView = TableView::create(this, Size(contentWidth, contentHeight));
itemsTableView->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
itemsTableView->setPosition(Vec2(xLeft, yBottom));
itemsTableView->setVerticalFillOrder(TableView::VerticalFillOrder::TOP_DOWN);
itemsTableView->setDelegate(this);

I am not sure what I’m missing. Perhaps there is some undetermined default that I am not setting.

Any help appreciated. Thank you.

Answering my own question … after a couple of hours of poking into the code, I found out that the top position of the TableView is higher than my desired position. The background being transparent made this less obvious to figure out. My second TableView behaves exactly as my first now. Problem solved! :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.