852 Size widgetSize =
_widget->getContentSize();
855 _displayValueLabel = Text::create(
"PageView disable touch",
"fonts/Marker Felt.ttf", 32);
858 widgetSize.height / 2.0f +
863 Text* alert = Text::create(
"PageView",
"fonts/Marker Felt.ttf", 30);
864 alert->setColor(Color3B(159, 168, 176));
865 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f));
868 Layout* root =
static_cast<Layout*
>(
_uiLayer->getChildByTag(81));
870 Layout* background =
dynamic_cast<Layout*
>(root->getChildByName(
"background_Panel"));
873 PageView* pageView = PageView::create();
874 pageView->setContentSize(Size(240.0f, 130.0f));
875 Size backgroundSize = background->getContentSize();
876 pageView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
877 (backgroundSize.width - pageView->getContentSize().width) / 2.0f,
878 (widgetSize.height - backgroundSize.height) / 2.0f +
879 (backgroundSize.height - pageView->getContentSize().height) / 2.0f));
880 pageView->setDirection(ui::PageView::Direction::VERTICAL);
881 pageView->setTouchEnabled(
false);
882 pageView->removeAllItems();
885 for (
int i = 0; i < pageCount; ++i)
887 Layout* layout = Layout::create();
888 layout->setContentSize(Size(240.0f, 130.0f));
890 ImageView* imageView = ImageView::create(
"cocosui/scrollviewbg.png");
891 imageView->setScale9Enabled(
true);
892 imageView->setContentSize(Size(240.0f, 130.0f));
893 imageView->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f));
894 layout->addChild(imageView);
896 Text* label = Text::create(StringUtils::format(
"page %d",(i+1)),
"fonts/Marker Felt.ttf", 30);
897 label->setColor(Color3B(192, 192, 192));
898 label->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f));
899 layout->addChild(label);
901 pageView->insertCustomItem(layout, i);
cocos2d::Layer * _uiLayer
virtual bool init() override
cocos2d::ui::Layout * _widget