void CPlayerNameSettingLayer::TouchKeyboard( cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent ) { CCTouch *pTouch = (CCTouch *)pTouches->anyObject(); CCPoint point = pTouch->getLocationInView(); point = CCDirector::sharedDirector()->convertToGL(point); CCTextFieldTTF *textfield = (CCTextFieldTTF *)this->getChildByTag(100); CCRect rect = textfield->boundingBox(); if(rect.containsPoint(point)) { textfield->attachWithIME(); } }
void TextFieldTTFActionTest::onClickTrackNode(bool bClicked) { CCTextFieldTTF * pTextField = (CCTextFieldTTF*)m_pTrackNode; if (bClicked) { // TextFieldTTFTest be clicked CCLOG("TextFieldTTFActionTest:CCTextFieldTTF attachWithIME"); pTextField->attachWithIME(); } else { // TextFieldTTFTest not be clicked CCLOG("TextFieldTTFActionTest:CCTextFieldTTF detachWithIME"); pTextField->detachWithIME(); } }