You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
795 B

  1. cc.PageView.ClassName = "PageView"
  2. function cc.PageView:extend(node)
  3. cc.Layout:extend(node);
  4. node:setName("PageView")
  5. end
  6. function cc.PageView:createNode()
  7. local layer = cc.PageView:create();
  8. cc.PageView:extend(layer);
  9. return layer;
  10. end
  11. -- 重载addChild,让他通过addPage来实现
  12. function cc.PageView:addChild(child)
  13. local t = tolua.type(child);
  14. if t ~= "cc.Layout" and t ~= "cc.ScrollView" and t ~= "cc.ListView" and t ~= "cc.PageView" then
  15. alert("PageView的子元素必须是容器控件(Layout / ScrollView / ListView / PageView)");
  16. return;
  17. end
  18. self:addPage(child);
  19. end
  20. -- 设置默认值
  21. function cc.PageView:setDefaults()
  22. cc.Layout.setDefaults(self);
  23. self:setBackGroundColor(cc.c3b(150,150,100));
  24. -- 默认需要响应touch事件
  25. self:setTouchEnabled(true)
  26. end