Question

I wanted to know If there is some way I could use three touches with a UIScrollView. What I want in the end is to have the UIScrollView only be passed one UITouch (or at least think it it has only one touch), but have three touches down. I want to use the let's just say the middle finger or find the average (x , y) of the three touches and use that (x , y) as my one touch being sent to the UIScrollView. If anyone knows or has any idea how I may accomplish this then please upload some code if possible.

Was it helpful?

Solution

If you put three fingers down the UIScrollView won't scroll, so you don't have to worry about disabling the default behavior. To scroll it with three fingers, do your crazy math to get the average using the normal touch functions, and then use - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated to scroll automatically.

OTHER TIPS

You can probably implement your idea by subclassing UIScrollView and then implement a different behaviour in touchedBegan/Moved/Ended, modifying the touches and passing them to the superclass if needed.

Personally I think you should not introduce complex gestures. Most people already have problems with two finger gestures. It took me a year to find out that two finger tap in Maps.app also did zooming. (Maybe I'm dumb though)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top