CCTableView not calling CCScrollViewDelegate methods

Hi,

I got a class with a CCTableView, so it’s implementing CCTableViewDataSource and CCTableViewDelegate methods.

It also means, I have to implement CCScrollViewDelegate methods:

void scrollViewDidScroll(cocos2d::extension::CCScrollView* view); void scrollViewDidZoom(cocos2d::extension::CCScrollView* view);

But the problem is:

This methods are not being called on my class (where CCTableView is created and defined as CCTableView delegate).

If you check this functions on CCTableView, the only method which is calling back to CCTableView delegate is “ccTouchEnded” (line 508, cocos2dx 2.0.4):
>m_pTableViewDelegate->tableCellTouched(this, cell);

What I did to solve this problem and get callback from scrollView methods is included this code at the end of this function:

void CCTableView::scrollViewDidScroll(CCScrollView* view)
if (m_pTableViewDelegate)
{
m_pTableViewDelegate->scrollViewDidScroll(view);
}
>
I would like to know if it is a cocos bug or I’m doing something wrong and I can do something better to solve this issue.

:slight_smile:

Yes its bug

there is other bug to in cctable view if ur row count is 0 then its keep calling void CCTableView::scrollViewDidScroll(CCScrollView* view)

to fix add add an extra check row count

@ unsigned int uNumberOfRows = m_pDataSource->numberOfCellsInTableView(this);
if (uNumberOfRows == 0) {
return;
}@

you are good to go :slight_smile: