又一次被quick中的三套ui系统坑了,每次都找不到cocosstudio的scroll源码在哪里
本来想实现一个类似上拉刷新的功能
结果addEventListener 这个方法试了好多。。才找到
做一下标记吧,省得下次还是找半天
self.scroll = self.bg:getChildByName("rank_scroll") self.scroll:addEventListener(handler(self,self.scrollCallback)) function Rank:scrollCallback(sender,event) if event == ccui.ScrollviewEventType.scrollToTop then print("scroll top") elseif event == ccui.ScrollviewEventType.scrollToBottom then print("scroll bottom") end end
ccui.ScrollviewEventType = { scrollToTop = 0,scrollToBottom = 1,scrollToLeft = 2,scrollToRight = 3,scrolling = 4,bounceTop = 5,bounceBottom = 6,bounceLeft = 7,bounceRight = 8,}原文链接:https://www.f2er.com/cocos2dx/339087.html