版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/W_han__/article/details/87969384
var tx_searchUser = new cc.EditBox(cc.size(502, 62), new cc.Scale9Sprite('res/newnewclub/members/searchbg.png'))
tx_searchUser.setName("tx_searchUser");
tx_searchUser.setAnchorPoint(0, 0)
tx_searchUser.setPosition(260.35, 57.81);
tx_searchUser.setDelegate(this);
tx_searchUser.setMaxLength(40);
tx_searchUser.setFontSize(26);
tx_searchUser.setPlaceholderFont(res.default_ttf, 22);
tx_searchUser.setPlaceHolder("请输入要查找的关键字");
tx_searchUser.setPlaceholderFontColor(cc.color(148, 95, 40));
tx_searchUser.setFontColor(cc.color(148, 95, 40));
tx_searchUser.setInputFlag(cc.EDITBOX_INPUT_FLAG_SENSITIVE);//修改为不使用密文
tx_searchUser.setInputMode(cc.EDITBOX_INPUT_MODE_ANY);
this.addChild(tx_searchUser);
代码创建cc.EditBox 输入编辑框
方法回调
editBoxEditingDidBegin: function (editBox) {
cc.log("editBox " + editBox.getName() + " DidBegin !");
},
editBoxEditingDidEnd: function (editBox) {
cc.log("editBox " + editBox.getName() + " DidEnd !");
},
editBoxTextChanged: function (editBox, text) {
cc.log("editBox " + editBox.getName() + ", TextChanged, text: " + text);
//查找用户数据
this.resetSearchData(text);
},
editBoxReturn: function (editBox) {
cc.log("editBox " + editBox.getName() + " was returned !");
},