sorry my bad English.
I have trouble using IME.
I trying to detach IME when touch other position
but touch event not occur when IME showed.
there is some source code.
class MyView : public cocos2d::CCLayerColor, public cocos2d::CCIMEDelegate, public cocos2d::CCTextFieldDelegate
{
....//something
cocos2d::CCTextFieldTTF* m_textField;
}
MyView::MyView()
{
CCTouchDispatcher* dipatcher = CCDirector::sharedDirector()->getTouchDispatcher();
dipatcher->addTargetedDelegate(this, 0, true);
}
MyView* MyView::create(void)
{
MyView* view = new MyView();
view->Init();
view->autorelease();
}
void MyView::Init(void)
{
CCLayerColor::Init();
m_textField = CCTextFieldTTF::textFieldWithPlaceHolder("type command", CCSizeMake(630, 50), kCCTextAlignmentLeft, fontList[0].c_str(), 36);
m_textField->setPosition(CCPointMake(320.0f, 590.0f));
m_textField->setColor(ccc3(0, 0, 0));
m_textField->setDelegate(this);
m_textField->attachWithIME(); //<---- attach IME
this->addChild(m_textField);
}
bool ConsoleView::ccTouchBegan(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent)
{
/*when IME attached touch event not occur*/
CCLOG("ccTouchBegan In");
return true;
}
thank you.