0

I have a button in my application which is supposed to scroll the scrollview from bottom to top (like "dragging" the scrollview from the bottom of the screen. The problem is that everything is inside this scrollview (2 view controllers are subviews of this scrollview - one is currently visible and second one is in the bottom of the screen unseen). That means that if I drag from everywhere on the screen, my second view controller gets dragged from the bottom of the page, which I don't want to happen.

Is there a way to recognise a touch point in scrollview and, according to the position of this touch, enable scrolling the scrollview?

Please advise, Thanks!

user-123
  • 874
  • 1
  • 13
  • 34

1 Answers1

1

Try this:

CGPoint locationPoint = [[touches anyObject] locationInView:self.view];
    CGPoint viewPoint = [myScrollView convertPoint:locationPoint fromView:self.view];
    if ([myScrollView pointInside:viewPoint withEvent:event]) {
       //do something
    }
Antonio MG
  • 20,382
  • 3
  • 43
  • 62
  • I think you misunderstood my problem :) Every touch will be inside my scrollview. Again, I have 2 view controllers. Both of them occupy the whole screen and are subviews of the scrollview. Only one can be seen at a time. Think of the bottom one as Menu View Controller that only its hand is visible at the bottom of the screen, and by dragging it you can pull the menu up... I need it to recognise I touched this hand and not anywhere.. – user-123 Jun 19 '13 at 11:55