var textField = new cc.TextFieldTTF("<click here for input>", cc.size(100,50), cc.TEXT_ALIGNMENT_LEFT,"Arial", 32);
this.addChild(textField);
textField.x = winSize.width / 2;
textField.y = winSize.height / 2;
发现没有输入框显示
var textField = new cc.TextFieldTTF("<click here for input>", cc.size(100,50), cc.TEXT_ALIGNMENT_LEFT,"Arial", 32);
this.addChild(textField);
textField.x = winSize.width / 2;
textField.y = winSize.height / 2;
发现没有输入框显示
你是说没有背景么?背景的话你可以加张图片进去。
或者你可以试试editbox.
谢谢你的回复。
我使用了editbox发现在模拟器上OK ,打包出来就看不到图片(全黑)
我的代码
this._super();
// 2.获取窗口大小
var winSize = cc.director.getWinSize();
// 3.窗口中心
var centerpos = cc.p(winSize.width / 2, winSize.height / 2);
// 4.创建背景图片
var spritebg = new cc.Sprite(res.login_png);
spritebg.setPosition(centerpos);
this.addChild(spritebg);
// (size, normal9SpriteBg, press9SpriteBg, disabled9SpriteBg)
var normal9SpriteBg=new cc.Scale9Sprite(res.login1_png);
var press9SpriteBg=new cc.Scale9Sprite(res.login2_png);
var disabled9SpriteBg=new cc.Scale9Sprite(res.login3_png);
this._userName = new cc.EditBox(cc.size(249, 44),normal9SpriteBg,press9SpriteBg,disabled9SpriteBg );
this._userName.x = cc.winSize.width/2;
this._userName.y = cc.winSize.height/2;
this._userName.setFontSize(8);
this._userName.setDelegate(this);
this._userName.setMaxLength(8);
this._userName.setFontColor(cc.color(0, 0, 0, 0));
this.addChild(this._userName);
手机上没有图片显示
你打包出来,是在哪个平台上运行?手机浏览器,还是native,以apk的方式运行的?
请问你的setMaxLength 这个设置了有用吗?
能发资源吗???
EditBox在手机上测试,背景图片会被手机自带的打字框挤压上去,如何解决?