标签:cocos2dx cocostudio ui
我用的是cocos2dx2.2版本,textfield的settouchsize 只是一个样式,点击输入框的时候只有点击到文字才能进行输入,当文本长度很短视,体验感差的不行
直接说方法吧,废话也没人看、、
为要点击的区域增加 imageview
exchangeTextBg = dynamic_cast<ImageView *>(ui->getWidgetByName("reward_exchange_bg_0")); exchangeTextBg->setTouchEnabled(true); exchangeTextBg->addTouchEventListener(this,toucheventselector(RewardExchangePanel::onTouchExhcangeTextBg));这个是textfield
exchangeTextField = dynamic_cast<TextField *>(ui->getWidgetByName("reward_exchange_text"));
void onTouchExhcangeTextBg(CCObject *target,TouchEventType type);
void RewardExchangePanel::onTouchExhcangeTextBg(CCObject *target,TouchEventType type) { if( type != TouchEventType::TOUCH_EVENT_ENDED) return; exchangeTextField->attachWithIME(); exchangeTextField->setColor(ccc3(70,155,87)); }以后再也不用纠结输入框点击区域范围太小的问题了,哈哈
CocoStudio textfiled 文本点击区域按背景拉伸
标签:cocos2dx cocostudio ui
原文地址:http://blog.csdn.net/littlefool5201314/article/details/42520853