"Cocos2dx-game development Three or four" COCOS2DX 3.0 TableView Special use method: Can't choose when scrolling, etc.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.