|
| 1 | +--- VScrollView |
| 2 | +-- 垂直滚动的View |
| 3 | +-- |
| 4 | +-- VScrollView的父类是[View](./View.html), 子类有[TableView](./TableView.html), [CollectionView](./CollectionView.html) |
| 5 | +-- @classmod VScrollView |
| 6 | + |
| 7 | + |
| 8 | +--- 通过这个方法创建一个VScrollView对象 |
| 9 | +-- @treturn VScrollView view |
| 10 | +-- @usage |
| 11 | +-- Cell |
| 12 | +-- local scrW, scrH = System.screenSize(); |
| 13 | +-- local cellW = scrW; |
| 14 | +-- local cellH = 130; |
| 15 | +-- CellJinrishouxuan = {}; |
| 16 | +-- CellJinrishouxuan.width = cellW; |
| 17 | +-- CellJinrishouxuan.height = cellH; |
| 18 | +-- function CellJinrishouxuan.create(originCell) |
| 19 | +-- local cell = {}; |
| 20 | +-- cell.cellInited = false; |
| 21 | +-- function cell.init() |
| 22 | +-- if (self.cellInited == false ) then |
| 23 | +-- self.cellInited = true; |
| 24 | +-- self.scrollView = VScrollView(); |
| 25 | +-- self.scrollView.frame( 0, 0, cellW, cellH ); |
| 26 | +-- self.items = {}; |
| 27 | +-- for i=1,3 do |
| 28 | +-- local item = CellProductSmall.create(nil, cellW / 3, cellH ); |
| 29 | +-- self.scrollView.addView(item.view); |
| 30 | +-- item.xy(cellH*(i-1),0 ); |
| 31 | +-- self.items[i] = item; |
| 32 | +-- item.bizIconUrl = "https://gw.alicdn.com/tps/TB1Q6oxKpXXXXbcXVXXXXXXXXXX-86-96.png"; |
| 33 | +-- end |
| 34 | +-- self.scrollView.contentSize(3*cellH, cellH); |
| 35 | +-- self.scrollView.showScrollIndicator(true,false) |
| 36 | +-- self.scrollView.backgroundColor(0xffffff); |
| 37 | +-- end |
| 38 | +-- end |
| 39 | +-- function cell.layout(model,option) |
| 40 | +-- if(not model) then return end |
| 41 | +-- local itemList = model.itemList; |
| 42 | +-- local num = table:getn(itemList); |
| 43 | +-- for i=1, num do |
| 44 | +-- local model = itemList[i]; |
| 45 | +-- local item = self.items[i]; |
| 46 | +-- item.layout(model,option); |
| 47 | +-- end |
| 48 | +-- end |
| 49 | +-- cell.init(); |
| 50 | +-- return cell; |
| 51 | +-- end |
| 52 | +function VScrollView() |
| 53 | +end |
| 54 | + |
| 55 | +--- 设置ContentSize大小 |
| 56 | +-- @number w 宽 |
| 57 | +-- @number h 高 |
| 58 | +function contentSize() |
| 59 | +end |
| 60 | + |
| 61 | +--- 获取ContentSize大小 |
| 62 | +-- @treturn number w 宽 |
| 63 | +-- @treturn number h 高 |
| 64 | +function contentSize() |
| 65 | +end |
| 66 | + |
| 67 | +--- 设置ContentSize大小 |
| 68 | +-- @number x x滚动偏移位置 |
| 69 | +-- @number y y滚动偏移位置 |
| 70 | +-- @bool animation 是否动画 参数可以省略 |
| 71 | +function offset() |
| 72 | +end |
| 73 | + |
| 74 | +--- 获取contentOffset大小 |
| 75 | +-- @treturn number x |
| 76 | +-- @treturn number y |
| 77 | +function offset() |
| 78 | +end |
| 79 | + |
| 80 | +--- 设置contentInset(只对IOS有效) |
| 81 | +-- @number top |
| 82 | +-- @number left |
| 83 | +-- @number bottom |
| 84 | +-- @number right |
| 85 | +function contentInset() |
| 86 | +end |
| 87 | + |
| 88 | +--- 获取contentInset(只对IOS有效) |
| 89 | +-- @treturn number top |
| 90 | +-- @treturn number left |
| 91 | +-- @treturn number bottom |
| 92 | +-- @treturn number right |
| 93 | +function contentInset() |
| 94 | +end |
| 95 | + |
| 96 | +--- 设置是否显示滚动条 |
| 97 | +-- @bool showsHorizontal 显示水平滚动条 |
| 98 | +function showScrollIndicator() |
| 99 | +end |
| 100 | + |
| 101 | +--- 获取是否显示滚动条信息 |
| 102 | +-- @treturn bool showsHorizontal 显示水平滚动条 |
| 103 | +function showScrollIndicator() |
| 104 | +end |
| 105 | + |
| 106 | +-- --- 代码控制 开始下拉刷新动画 |
| 107 | +-- function startRefreshing() |
| 108 | +-- end |
| 109 | + |
| 110 | +-- --- 停止下拉刷新动画(数据已经加载完成后调用) |
| 111 | +-- function stopRefreshing() |
| 112 | +-- end |
| 113 | + |
| 114 | +-- --- 是否正在下拉刷新动画中 |
| 115 | +-- function isRefreshing() |
| 116 | +-- end |
| 117 | + |
0 commit comments