lua 创建scrollview
2014-02-21 17:03
429 查看
一、创建滚动层
function create_Scrollview()--infolayer为整个滚动层 有什么元素都加到上面去
local infoRect = CCRectMake(45, 105, 260, 370)
infolayer = CCLayerColor:layerWithColorWidthHeight(ccc4(0, 128, 128, CORLORLAYERENABLE), infoRect.size.width, infoRect.size.height)
infolayer:setAnchorPoint(CCPointMake(0.5, 1.0))
--anchorPoint这个属性虽然是属于CCNode的、但CCLayer设置anchorPoint没有效果、
--CCLayer的anchorPoint被默认设定在(0, 0)、在setAnchorPoint之前要先设置setIsRelativeAnchorPoint = true
infolayer:setIsRelativeAnchorPoint(true)
infolayer:setPosition(PT(130, 370))
--ScrollLayerExtLayer为当前显示的层
ScrollLayerExtLayer = CCScrollLayerExt:CreateScrollLayerExt(infolayer, infoRect)
-- 两种排列 SCROLLLAYERSTYLE_HORIZONTAL 水平 SCROLLLAYERSTYLE_VERTICAL 竖直
ScrollLayerExtLayer:SetListViewCustormer(SCROLLLAYERSTYLE_VERTICAL)
--拖动时候的滚动效果
ScrollLayerExtLayer:SetScrollBackFlg(true)
--显示要不要显示滚动条,第一个是水平 第二个参数垂直
ScrollLayerExtLayer:SetScrollerShowFlg(false, false)
layerBG:addChild(ScrollLayerExtLayer)
相关文章推荐
- lua的闭包概念理解与介绍
- vs2012 cpp与lua的hello world
- Lua学习与交流—— pairs 与 ipairs
- lua学习:把lua文本文件“编译”成二进制的文本
- Lua编译器
- Lua解释器
- lua 常用语法
- 函数闭包的方式实现lua面向对象
- [LeetCode] Evaluate Reverse Polish Notation
- lua面向对象是怎么实现的
- 重写require使lua文件模块化
- lua学习之table类型
- how to read lua?
- sublime text 3绑定lua编译器
- protobuf for lua in Mac
- Mac 上Sublime Text 2配置lua环境
- 天天LeetCode之Evaluate Reverse Polish Notation
- 1. what is Lua?
- Step By Step(Lua开篇)
- Step By Step(Lua基础知识)