diff --git a/cocos2d/core/components/editbox/CCEditBox.js b/cocos2d/core/components/editbox/CCEditBox.js index 473e80dc1a..aaf4317def 100644 --- a/cocos2d/core/components/editbox/CCEditBox.js +++ b/cocos2d/core/components/editbox/CCEditBox.js @@ -198,6 +198,7 @@ let EditBox = cc.Class({ default: 'Enter text here...', notify () { this._placeholderLabel.string = this.placeholder; + this._impl.setPlaceholderText(this.placeholder); } }, @@ -339,6 +340,7 @@ let EditBox = cc.Class({ impl.setTabIndex(this.tabIndex); impl.setFontColor(this.fontColor); impl.setFontSize(this.fontSize); + impl.setPlaceholderText(this.placeholder); impl.setDelegate(this); diff --git a/cocos2d/core/components/editbox/CCEditBoxImpl.js b/cocos2d/core/components/editbox/CCEditBoxImpl.js index 85ee31bc57..3fb18265e3 100644 --- a/cocos2d/core/components/editbox/CCEditBoxImpl.js +++ b/cocos2d/core/components/editbox/CCEditBoxImpl.js @@ -146,6 +146,14 @@ let EditBoxImpl = cc.Class({ return this._text; }, + setPlaceholderText (text) { + this._placeholderText = text; + }, + + getPlaceholderText () { + return this._placeholderText; + }, + setDelegate (delegate) { this._delegate = delegate; },