cocos2dx之CCEditBox
来源:互联网 发布:手机时时彩看号软件 编辑:程序博客网 时间:2024/05/16 03:24
上一篇文章是用到CCTextFieldTTF来创建的一个输入框,现在我们用CCEditBox来创建一个输入框,它是在2.0版本后加入的,好了,看例子吧:
CCEditBox *m_InputBox;
定义一个editbox;
void MyEditBoxLayer::initLayer() {CCSize size = CCDirector::sharedDirector()->getWinSize();CCScale9Sprite *s9sprite = CCScale9Sprite::create("face.jpg");m_InputBox = CCEditBox::create(CCSizeMake(100, 50),s9sprite);m_InputBox->setAnchorPoint(ccp(0.5f, 0.5f));m_InputBox->setPosition(ccp(100, 200));this->addChild(m_InputBox, 1);m_InputBox->setColor(ccc3(255, 0, 0));m_InputBox->setText("so I Create an edit box");m_InputBox->setMaxLength(10); //这个在PC上没有作用的。m_InputBox->setOpacity(200);m_InputBox->setFontSize(10);//m_InputBox->setInputFlag(kEditBoxInputFlagPassword);m_InputBox->setInputMode(kEditBoxInputModeEmailAddr);}
kEditBoxInputFlagPassword, kEditBoxInputModeEmailAddr详解:
/** * \brief The EditBoxInputMode defines the type of text that the user is allowed * to enter. */enum EditBoxInputMode{ /** * The user is allowed to enter any text, including line breaks. */ kEditBoxInputModeAny = 0, /** * The user is allowed to enter an e-mail address. */ kEditBoxInputModeEmailAddr, /** * The user is allowed to enter an integer value. */ kEditBoxInputModeNumeric, /** * The user is allowed to enter a phone number. */ kEditBoxInputModePhoneNumber, /** * The user is allowed to enter a URL. */ kEditBoxInputModeUrl, /** * The user is allowed to enter a real number value. * This extends kEditBoxInputModeNumeric by allowing a decimal point. */ kEditBoxInputModeDecimal, /** * The user is allowed to enter any text, except for line breaks. */ kEditBoxInputModeSingleLine};/** * \brief The EditBoxInputFlag defines how the input text is displayed/formatted. */enum EditBoxInputFlag{ /** * Indicates that the text entered is confidential data that should be * obscured whenever possible. This implies EDIT_BOX_INPUT_FLAG_SENSITIVE. */ kEditBoxInputFlagPassword = 0, /** * Indicates that the text entered is sensitive data that the * implementation must never store into a dictionary or table for use * in predictive, auto-completing, or other accelerated input schemes. * A credit card number is an example of sensitive data. */ kEditBoxInputFlagSensitive, /** * This flag is a hint to the implementation that during text editing, * the initial letter of each word should be capitalized. */ kEditBoxInputFlagInitialCapsWord, /** * This flag is a hint to the implementation that during text editing, * the initial letter of each sentence should be capitalized. */ kEditBoxInputFlagInitialCapsSentence, /** * Capitalize all characters automatically. */ kEditBoxInputFlagInitialCapsAllCharacters};
0 0
- cocos2dx之CCEditBox
- cocos2dX UI控件之CCEditBox
- cocos2dx CCEditBox
- cocos2dx-CCEditBox
- 【COCOS2DX-游戏开发之二九】CCEditBox的各种问题
- cocos2dx cceditbox使用注意事项
- CCEditBox之接口篇
- 和屌丝一起学cocos2dx-CCEditBox
- cocos2dx一编辑框的使用CCEditBox
- cocos2dx-CCEditBox输入框中英文检测
- Cocos2dx-CCEditBox输入框中英文检测
- ccEditbox
- CCEditBox使用之准备篇
- CCEditBox/CCEditBox
- cocos2d-x之码农工作笔记CCEditBox
- CCEditBox之创建与常用函数
- 6、Cocos2d-X 游戏编程之------CCEditBox的实现
- CCEditBox/CCEditBoxImplWin
- 使用Java自带API MD5算法
- 心情의 組織 (心情은 天性에서 發한다)(韓長庚 易學原理總論)
- 移动开发的工具和战略
- NSArray、NSMutableArray-OC+class
- WCF 回调
- cocos2dx之CCEditBox
- JS事件绑定
- java中关于字符编码解码的思考
- 心의 體는 仁禮義知 (韓長庚 易學原理總論)
- 筛选法求100以内的素数(数组)
- android默认输入法配置
- 日常防护,免受打鼾危害
- 退出整个应用
- R语言中的机器学习包