Hi, Alex.
This is sample code
-- Sample code (screen size 960x640, landscape mode) local widget = require 'widget' local scrollViewHeight = 495 -- make scrollView local scrollView = widget.newScrollView{ left=60, top=60, -- 770x495 width=770, height=scrollViewHeight, scrollWidth=770, scrollHeight=scrollViewHeight, hideBackground = false, backgroundColor = {0.2,0.2,0.2}, isHitTestMasked = true, horizontalScrollDisabled = true, maskFile = "images/mask/400x400.png" } scrollView.maskScaleX = 770/400 scrollView.maskScaleY = scrollViewHeight/400 -- texts local textGroup = display.newGroup() local textLines = 50 for i = 1, textLines do local text = display.newText{ parent=textGroup, text = 'Hello Corona. '..i, fontSize=21} text.x, text.y = 0, i\*22 end scrollView:insert( textGroup ) textGroup.x, textGroup.y = 100, 100 -- scrollToBottom button local bottomBtn = display.newRect( 0,0, 100, 20 ) bottomBtn.x, bottomBtn.y = 480, 620 bottomBtn:addEventListener('touch', function(e) if e.phase == 'began' then -- \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -- \*\*\*\*\*\* weird scroll position \*\*\*\*\*\*\* -- \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* scrollView:scrollTo('bottom', {time=100}) end end) -- delayed contents height changing (set random height to show what happens) timer.performWithDelay(2000, function() local randomHeight = textGroup.height + math.random(1, 100) print('randomHeight: '..randomHeight) -- \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -- \*\*\*\*\* this forces scroll to top \*\*\*\* -- \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* scrollView:setScrollHeight( randomHeight ) end, 0)
Best regards.