Interesting matching puzzle UIScrollView

Let's say you have two scroll lists, one vertical and one horizontal, that overlap in a plus sign pattern. Let's say you have one object (like UIImageView) in the center of the plus. If you touch an object and scroll up, you want the object to scroll up in vertical scrolling. But if you touch the object and scroll sideways, you want it to scroll horizontally.

Problems:

  • Which scrollview is the object originally? Or is it none? You don't know what scrolling the object is viewing until you find that the scroll scroll has started scrolling.

  • If vertical scrolling is on top, horizontal scrolling will not receive strokes in the center area where scroll intersections overlap.

Can anyone think of any solutions to this problem? (Redesign is not a solution)

Another way to think about this: you have a 100x100 grid, but you can only see the 10x10 grid on the screen. You want to be able to scroll each row from the side, but you also want to be able to scroll each column vertically. Obviously, the scroll position would have to be fixed to the nearest multiple of the tile size before each new touch / scroll starts. But this means that at any given time, any tile can be in horizontal or vertical scrolling.

+3


source to share


1 answer


Use the (single) scroll view (s directionLockEnabled = YES

) for your physics, but don't actually do it over your list of chunks.



For more information, see the WWDC2012 video "Enhancing the User Experience with Scrolling".

0


source







All Articles