Page 1 of 1

Swiping with native scroller?

Posted: Sun Jun 10, 2018 1:26 am
by Jim Mac
I know this can't be this hard. I have a few cards with a single native scroller on each of them (iPhone 6 screen). I'd like to be able to have the user swipe between cards but can't get anything working. I've read through everything I can with old threads but....I haven't found anything that really works.
- The hScroll approach is too binary for my use. I scroll the field a bit off and get an hScroll that flips the page when I din;t want it to.
- I've tried mouseDown/mouseUp and touchStart/touchMove/touchEnd but am getting really inconsistent results. Sometimes it fires, sometoimes not... nothig I can be proud of/happy with.

I had assumed I'd be able to track mouse/touch position and react when the "swipe" got big enough.

Can I do this?
My 1st fallback is arrows (which I think I'd need for Android anyway?) but ther has to be a better way.
My next will be hand coding the behavior I want but that's definitely going to look clunky.

Is this just me? Am I being naive? stupid?

Any help would be appreciated

Re: Swiping with native scroller?

Posted: Sun Jun 10, 2018 8:31 pm
by jacque
My 1st fallback is arrows (which I think I'd need for Android anyway?)
Android uses swiping too. I ran into the same problem a couple of years ago with a scroller over an image. I was not getting mouseUps consistently so I couldn't calculate the distance of the swipe. If I remember right, no mouseUp was sent if the end location was outside of the scroller area (which is likely when swiping quickly.) We did end up with arrows because of that.

I don't remember if I tried tracking with scrollerBeginDrag and scrollerEndDrag, but that's a possibility if you want to try it. Get the mouseloc on beginDrag and compare it to the mouseloc on endDrag and see if that works. But it may be that you won't get a scrollerEndDrag either if the swipe ends outside the scroller. If you try it, I'll be curious what you find.

Re: Swiping with native scroller?

Posted: Tue Jun 12, 2018 12:53 am
by quailcreek
There are several ways to handle this. I put together a down and dirty stack. Take a look and see if this approach will work for you. I took this from one of my existing apps so not every line of the code will apply.
Swipe Between
(2.99 KiB) Downloaded 45 times

Re: Swiping with native scroller?

Posted: Fri Jun 15, 2018 4:46 pm
by Jim Mac
Quick update:
1) Thanks for the touch code. I tend to do desktop only so forget about touch. Seems more "mobile" than mouseXXX though not sure why.
2) As long as the touch starts "outside" of the native scroller, things act as expected. This either means TouchEnd is working as expected or entering the native scroller discontinues the touch. Easy to see by checking coordinates but haven't yet. Will....
3) Starting a swipe "in" the native scroller is still a no go. Shame.

I have more testing to do and can see some options:
1) Using some combination of the hScroll of the native scroller and it's geometry to detect swipes vs scrolls
2) Using mergButton (control on "top" of scroller?) to simulate touch zones above the scroller
3) Adding a handler to the underlying field, detecting the touch and simulating a touch starting outside of the field
4) Just living with it.

For now, I'm trying to figure out how to teach the user to start the swipes at the edges of the screen....

Will add more when I have it.

Re: Swiping with native scroller?

Posted: Fri Jun 15, 2018 5:27 pm
by jacque
That was my experience too, and I tried various things that didn't work. The culprit was the lack of a mouseUp message inside the scroller. Touch messages may be similar but I can't remember. The odd thing is that taps do work so you might want to implement taps at the left and right sides to go to the next card. We felt that wasn't intuitive enough so we went with arrows.

I also submitted a bug report about it but I can't find it now. It was a couple of years ago.

Re: Swiping with native scroller?

Posted: Fri Jun 15, 2018 7:23 pm
by jacque
Found the bug report: Scroll down to my entries near the end. I guess I did try the touch messages apparently. You could add comments there, it would bring the report back up to the team's attention. It's been confirmed but there's no progress on it yet.

Re: Swiping with native scroller?

Posted: Wed Jun 20, 2018 3:41 pm
by mluka
Sorry for interrupting...

I was reading this post; this led me, somehow, to doing a search of the Dictionary with the argument "scroller".

This led me to "iosScroller". I don't really understand what it's talking about (although it does sound interesting). At the bottom of the entry, there is this:
Note: For full details of what the UIScrollViewContol is capable of, and background about it see the iOS reference document.
Please, WHAT is the "IOS reference document"??? WHERE does it exist? HOW can I get a copy???


Re: Swiping with native scroller?

Posted: Wed Jun 20, 2018 7:01 pm
by Klaus
Bonjour Michel,

you should poke around here a bit:
And here: ... ew/themes/

Get used to visit this often if you want to develop and publish for iOS! 8)



Re: Swiping with native scroller?

Posted: Thu Jun 21, 2018 12:24 am
by mluka
Hi Klaus.

Thank you for those great references.

Best regards.

Re: Swiping with native scroller?

Posted: Mon Jul 02, 2018 2:48 am
by Jim Mac
Just to get some closure.

I was never able to get a native scrolling field to reliably detect swipes the way I wanted.
The layout of my screen does however, have enough "open space" so that users swiping from the edge of the screen (or in areas not covered by the native scroller) get the effect they expect. They learn quickly to start their swipes right at the edge of the screen. For those who don't get that, I have arrows at the top of the screen which they gravitate to very quickly if they can't get a swipe to happen right away.

Is it the best solution? No. I'd like to have the entire screen available for swipes but it works and I haven't goten too many complaints.