Hi all, I found that setTouchPriority doesn’t work for me.
I have an instance of CCControlButton which is the subclass of CCLayer, it is added by the cocosbuilder.
As the touch delegate is not registered manually, I have to change it’s touch priority.
After going into the source code, I found that in the function setTouchPriority: the delegate is removed by setTouchEnabled(false), and reregister by function setTouchEnabled(true).
It is ok for CCLayer, because it registers the touch delegate by pDispatcher->addTargetedDelegate;
But for CCControl,
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, m_nDefaultTouchPriority, true);
It is still using m_nDefaultTouchPriority not m_bTouchPriority.
My walk around way is to change the default priority of a CCControlButton, and using setTouchPriority again to reregister it.
Or was I totally wrong with the CCControlButton?