在quick 3.3裏面存在isItemInViewRect方法判斷是否在可視區域,isItemInViewRect 源代碼修改如下即可
function UIListView:isItemInViewRect(pos)
local item
if "number" == type(pos) then
item = self.items_[pos]
elseif "userdata" == type(pos) then
item = pos
end
if not item then
return
end
local bound = item:getBoundingBox()
local nodePoint = self.container:convertToWorldSpace(
cc.p(bound.x, bound.y))
bound.x = nodePoint.x
bound.y = nodePoint.y
local viewRectPos = self:convertToWorldSpace(cc.p(self.viewRect_.x,self.viewRect_.y))
local viewRect = cc.rect(viewRectPos.x,viewRectPos.y,self.viewRect_.width,self.viewRect_.height)
return cc.rectIntersectsRect(viewRect, bound)
end
源代碼只把item座標轉化成世界座標,但是沒有將viewRect_轉化成世界座標
參考自http://blog.csdn.net/chjh0540237/article/details/43986223