Pull down to refresh swipe gesture
Paul Hibbert
paul at livecode.org
Thu Jul 2 12:28:53 EDT 2015
Skip,
http://lessons.runrev.com/m/4069/l/29603-creating-a-simple-stock-control-application-for-the-ipad (scroll down to "Using Swipe Gestures”).
I’ve adapted the LC lesson (link above) for something similar. Of course if you are testing for swipes left and right also, you may need a little more tweaking, but here’s the basics of the script…
local sCoordinateArray
on touchStart pID
## When the user touches the screen
put empty into sCoordinateArray["start"]
put empty into sCoordinateArray["end"]
end touchStart
on touchMove pID, x y
if sCoordinateArray["start"] is empty then
put y into sCoordinateArray["start"]
else
put y into sCoordinateArray["end"]
end if
end touchMove
on touchEnd
put sCoordinateArray["start"] into tStart
put sCoordinateArray["end"] into tEnd
## Compare the x coordinates of the start and end point
## This tells us the direction of the movement
if tStart is not empty and tEnd is not empty then
if tStart < tEnd and tEnd - tStart > 100 then
swipeDown
else if tStart > tEnd and tStart - tEnd > 100 then
swipeUp
end if
end if
put empty into sCoordinateArray["start"]
put empty into sCoordinateArray["end"]
end touchEnd
on swipeDown
answer "Swipe Down!"
end swipeDown
on swipeUp
answer "Swipe Up!"
end swipeUp
Paul
> On Jul 2, 2015, at 03:10, Skip Kimpel <skiplondon at gmail.com> wrote:
>
> Good morning,
>
> Has anybody created the "pull down to refresh" swipe gesture? I have an app where there is a refresh button on it but during testing I keep seeing users trying to pull down on the screen to achieve the function of refreshing the data.
>
> I am assuming it would need to be simulated and would not be native functionality, correct?
>
> SKIP
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list