#include <UIButtonTest.h>
◆ UIButtonScale9ChangeSpriteFrame()
| UIButtonScale9ChangeSpriteFrame::UIButtonScale9ChangeSpriteFrame |
( |
| ) |
|
◆ CREATE_FUNC()
◆ init()
| bool UIButtonScale9ChangeSpriteFrame::init |
( |
| ) |
|
|
overridevirtual |
重载 UIScene .
在文件 UIButtonTest.cpp 第 1273 行定义.
1277 ImageView* sprite = ImageView::create(
"Images/blocks.png");
1278 sprite->setScale9Enabled(
true);
1279 sprite->setCapInsets(Rect(32, 32, 32, 32));
1280 sprite->setContentSize(Size(96 * 1.5, 96));
1281 sprite->setNormalizedPosition(Vec2(0.2f, 0.5f));
1282 this->addChild(sprite);
1284 auto button = Button::create(
"cocosui/button.png",
"cocosui/buttonHighlighted.png");
1285 button->setScale9Enabled(
true);
1286 button->setContentSize(Size(100.0f, 50.0f));
1287 button->setNormalizedPosition(Vec2(0.6f, 0.5f));
1288 button->setTitleText(
"Press me");
1291 button->addClickEventListener([sprite](Ref* button){
1292 sprite->loadTexture(
"Images/blocks9.png");
virtual bool init() override
引用了 UIScene::init().
该类的文档由以下文件生成:
- /Users/yujizhu/Documents/Git/cocos2d-x-4.0/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.h
- /Users/yujizhu/Documents/Git/cocos2d-x-4.0/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp