void RadioMenu::onTouchMoved(Touch* touch, Event* event) { CCMenuItem *curSelection = this->getItemForTouch(touch); if (curSelection != _curHighlighted && curSelection != NULL) { _curHighlighted->unselected(); curSelection->selected(); _curHighlighted = curSelection; return; } }
///当点击CELL之后,判断是否点击到了某个菜单项,并置为选中状态 void CTableViewCell::selected(const CCPoint &touchPoint) { CCObject *pObject = NULL; CCARRAY_FOREACH_REVERSE(m_pArrItems, pObject) { CCMenuItem *pMenuItem = (CCMenuItem *) pObject; if(pMenuItem->isEnabled() && pMenuItem->isVisible()) { if(pMenuItem->boundingBox().containsPoint(touchPoint)) { pMenuItem->selected(); m_pTouchItem = pMenuItem; break; } } }