set TextInputTest CCTextField to center.

This commit is contained in:
yangws 2011-05-12 14:45:44 +08:00
parent a50fe1b95b
commit 01c5048203
1 changed files with 5 additions and 5 deletions

View File

@ -122,14 +122,14 @@ void TextInputTest::onEnter()
CCLabelTTF* label = CCLabelTTF::labelWithString(title().c_str(), "Arial", 24); CCLabelTTF* label = CCLabelTTF::labelWithString(title().c_str(), "Arial", 24);
addChild(label); addChild(label);
label->setPosition(ccp(s.width/2, s.height-20)); label->setPosition(ccp(s.width/2, s.height-50));
std::string subTitle = m_pNotificationLayer->subtitle(); std::string subTitle = m_pNotificationLayer->subtitle();
if(! subTitle.empty()) if(! subTitle.empty())
{ {
CCLabelTTF* l = CCLabelTTF::labelWithString(subTitle.c_str(), "Thonburi", 16); CCLabelTTF* l = CCLabelTTF::labelWithString(subTitle.c_str(), "Thonburi", 16);
addChild(l, 1); addChild(l, 1);
l->setPosition(ccp(s.width/2, s.height-40)); l->setPosition(ccp(s.width/2, s.height-80));
} }
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(TextInputTest::backCallback)); CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(TextInputTest::backCallback));
@ -278,7 +278,7 @@ void TextFieldTTFDefaultTest::onEnter()
FONT_SIZE); FONT_SIZE);
addChild(pTextField); addChild(pTextField);
pTextField->setPosition(ccp(s.width/2, s.height - 80)); pTextField->setPosition(ccp(s.width / 2, s.height / 2));
m_pTrackNode = pTextField; m_pTrackNode = pTextField;
} }
@ -313,7 +313,7 @@ void TextFieldTTFActionTest::onEnter()
{ {
KeyboardNotificationLayer::onEnter(); KeyboardNotificationLayer::onEnter();
m_nCharLimit = 10; m_nCharLimit = 12;
m_pTextFieldAction = CCRepeatForever::actionWithAction( m_pTextFieldAction = CCRepeatForever::actionWithAction(
(CCActionInterval*)CCSequence::actions( (CCActionInterval*)CCSequence::actions(
@ -333,7 +333,7 @@ void TextFieldTTFActionTest::onEnter()
addChild(m_pTextField); addChild(m_pTextField);
m_pTextField->setDelegate(this); m_pTextField->setDelegate(this);
m_pTextField->setPosition(ccp(s.width/2, s.height - 80)); m_pTextField->setPosition(ccp(s.width / 2, s.height / 2));
m_pTrackNode = m_pTextField; m_pTrackNode = m_pTextField;
} }