COCOS2DX 3.0 version number TableView from ScrollView, often used to do scrolling list, there are several special methods of use, do not know if you have ever
Requirements:1. TableCell cannot be selected when scrolling, non-scrolling status talent selected
Very easy, in the delegate function of TableView, through the istouchmoved () function to infer
void Weaponselectlayer::tablecellunhighlight (cocos2d::extension::tableview* table, Cocos2d::extension:: tableviewcell* cell) { if (table->istouchmoved ()) { return; } Todo:select item.}
Requirement 2: TableView can no longer be dragged when dragging to the edge without an option
void Weaponselectlayer::scrollviewdidscroll (cocos2d::extension::scrollview* view) {point off = view-> Getcontentoffset (); if (Off.y < View->mincontaineroffset (). Y) { view->setcontentoffset (point (off.x, view-> Mincontaineroffset (). y)); } if (Off.y > View->maxcontaineroffset (). Y) { view->setcontentoffset (point (off.x, view-> Maxcontaineroffset (). y));} }
There is a bug in this way, when you provide the TableCell can not fill the full tableview, there will be a recursive loop, but the guarantee can fill the whole tableview, the whole method is still able, assuming that we have a better way, listen to
"Cocos2dx-game development Three or four" COCOS2DX 3.0 TableView Special use method: Can't choose when scrolling, etc.