这个操作功能不建议使用,不适合触摸屏
bool LQMainLayer::ccTouchBegan(CCTouch* touch, CCEvent* event)
{
selctedNode = this->itemForTouch(this,touch); //先要判断是否是选中你要的东西
if(selctedNode && selctedNode->getTag()>=1000)
{
schedule(schedule_selector(LQMainLayer::touchUpdate), 2.0);
}
return true;
}
void LQMainLayer::touchUpdate(float dt)
{
CCLOG("我选中了:%d",selctedNode->getTag());
}
void LQMainLayer::ccTouchEnded(CCTouch* touch, CCEvent* event)
{
this->unscheduleAllSelectors();
}
1.先要判断是否是选中你要的东西
2.启动定时器
3.定时器到成功判断长按
4.销毁