iOS scroller performance

Colin Holgate coiin at
Sun Mar 24 23:40:04 EDT 2013

I suspect that iOS tweens scrolling. It doesn't get scroll changes any more often than LiveCode, but it tweens the values rather than jumping to the newly reported value. That can give the illusion that it is getting more events, or handling them quicker.

Try this as a button script:

on mouseUp
   scrollto 1,random(1000)
end mouseUp

and have one field on the card, with no scrollbars showing, but lots of text in it. Put this script into the card:

local scrollcount,scrolldiff,scrollingfield,currentscroll,finalscroll

on scrollto pFld,pScroll
   put pScroll into finalscroll
   put pFld into scrollingfield
   put the scroll of field pFld into currentscroll
   put (pScroll-currentscroll)/10 into scrolldiff
   put 10 into scrollcount
end scrollto

on scrollsome
   subtract 1 from scrollcount
   if scrollcount < 1 then
      set the scroll of field scrollingfield to finalscroll
      exit scrollsome
   end if
   add scrolldiff to currentscroll
   set the scroll of field scrollingfield to round(currentscroll)
   send "scrollsome" to me in 1 ticks
end scrollsome

It randomly scrolls the field, pretty smoothly.

So, don't scroll to the new value, just update a variable and then scroll towards that value 60 times per second.

More information about the Use-livecode mailing list